Index: trunk/src/find_field_cells.m
===================================================================
--- trunk/src/find_field_cells.m	(revision 1049)
+++ trunk/src/find_field_cells.m	(revision 1057)
@@ -306,8 +306,32 @@
         CellInfo{icell}.DimOrder=[];
         if NbDim(icell)==3
-            %coord z
-            for ivar=ind_coord_z
-                if check_coord_names(ivar)
-                    DimRank=find(strcmp(Data.VarDimName{ivar},DimCell_var));
+            if strcmp(DimCell_var{3},'rgb')
+                NbDim(icell)=2;% case of color images
+            else
+                %coord z
+                for ivar=ind_coord_z
+                    if check_coord_names(ivar)
+                        DimRank=find(strcmp(Data.VarDimName{ivar},DimCell_var));
+                        check_coord=~isempty(DimRank);
+                    elseif check_coord_raster(ivar)
+                        DimRank=find(strcmp(Data.ListVarName{ivar},DimCell_var));
+                        check_coord=~isempty(DimRank);
+                    end
+                    %                 check_coord= (check_coord_names(ivar) && strcmp(Data.VarDimName{ivar},DimCell_var{1}))||...% coord varbable
+                    %                     (check_coord_raster(ivar) && strcmp(Data.ListVarName{ivar},DimCell_var{1})); % rasrewr coord defined by min and max
+                    if check_coord
+                        CellInfo{icell}.CoordType='grid';
+                        CellInfo{icell}.CoordIndex(1)=ivar;
+                        CellInfo{icell}.ZName=Data.ListVarName{ivar};
+                        CellInfo{icell}.ZIndex=ivar;
+                        CellInfo{icell}.DimOrder=DimRank;
+                        break
+                    end
+                end
+            end
+        end
+        for ivar=ind_coord_y
+            if check_coord_names(ivar)
+                DimRank=find(strcmp(Data.VarDimName{ivar},DimCell_var));
                 check_coord=~isempty(DimRank);
             elseif check_coord_raster(ivar)
@@ -315,26 +339,6 @@
                 check_coord=~isempty(DimRank);
             end
-%                 check_coord= (check_coord_names(ivar) && strcmp(Data.VarDimName{ivar},DimCell_var{1}))||...% coord varbable
-%                     (check_coord_raster(ivar) && strcmp(Data.ListVarName{ivar},DimCell_var{1})); % rasrewr coord defined by min and max
-                if check_coord
-                    CellInfo{icell}.CoordType='grid';
-                    CellInfo{icell}.CoordIndex(1)=ivar;
-                    CellInfo{icell}.ZName=Data.ListVarName{ivar};
-                    CellInfo{icell}.ZIndex=ivar;
-                    CellInfo{icell}.DimOrder=DimRank;
-                    break
-                end
-            end
-        end
-        for ivar=ind_coord_y
-            if check_coord_names(ivar)
-                    DimRank=find(strcmp(Data.VarDimName{ivar},DimCell_var));
-                check_coord=~isempty(DimRank);
-            elseif check_coord_raster(ivar)
-                DimRank=find(strcmp(Data.ListVarName{ivar},DimCell_var));
-                check_coord=~isempty(DimRank);
-            end
-%             check_coord= (check_coord_names(ivar) && strcmp(Data.VarDimName{ivar},DimCell_var{NbDim(icell)-1}))||...% coord variable
-%                 (check_coord_raster(ivar) && strcmp(Data.ListVarName{ivar},DimCell_var{NbDim(icell)-1})); % rasrewr coord defined by min and max
+            %             check_coord= (check_coord_names(ivar) && strcmp(Data.VarDimName{ivar},DimCell_var{NbDim(icell)-1}))||...% coord variable
+            %                 (check_coord_raster(ivar) && strcmp(Data.ListVarName{ivar},DimCell_var{NbDim(icell)-1})); % rasrewr coord defined by min and max
             if check_coord
                 CellInfo{icell}.CoordType='grid';
@@ -348,5 +352,5 @@
         for ivar=ind_coord_x
             if check_coord_names(ivar)
-                    DimRank=find(strcmp(Data.VarDimName{ivar},DimCell_var));
+                DimRank=find(strcmp(Data.VarDimName{ivar},DimCell_var));
                 check_coord=~isempty(DimRank);
             elseif check_coord_raster(ivar)
@@ -354,6 +358,6 @@
                 check_coord=~isempty(DimRank);
             end
-%             check_coord= (check_coord_names(ivar) && strcmp(Data.VarDimName{ivar},DimCell_var{NbDim(icell)}))||...% coord variable
-%                 (check_coord_raster(ivar) && strcmp(Data.ListVarName{ivar},DimCell_var{NbDim(icell)})); % raster coord defined by min and max
+            %             check_coord= (check_coord_names(ivar) && strcmp(Data.VarDimName{ivar},DimCell_var{NbDim(icell)}))||...% coord variable
+            %                 (check_coord_raster(ivar) && strcmp(Data.ListVarName{ivar},DimCell_var{NbDim(icell)})); % raster coord defined by min and max
             if check_coord
                 CellInfo{icell}.CoordIndex(NbDim(icell))=ivar;
@@ -400,5 +404,5 @@
                     CellInfo{icell}.CoordSize=[size(Data.(VarName),3) size(Data.(VarName),2) size(Data.(VarName),1)];
                 else
-                    CellInfo{icell}.CoordSize=[size(Data.(VarName),2) size(Data.(VarName),1)];
+                    CellInfo{icell}.CoordSize=[size(Data.(VarName),1) size(Data.(VarName),2)];
                 end
             case 'tps'
