contourfm causing multiple errors

2 views (last 30 days)
Aaron Anderson
Aaron Anderson on 10 Apr 2017
I have been having an issue with plotting using contourfm. Sometimes I get a different error depending on what indices I am trying to plot of a structure array (each individual structure contains .lat, .lon, z fields (all 276x301)). By this I mean if I plot one slice of my structure array:
contourfm(smStruct(icase).lat,smStruct(icase).lon,smStruct(icase).jv)
I will get errors. Usually this isn't on the first loop, but sometimes it isn't the second either.
One seems related to indexing, and the other looks like some sort of assignment mismatch. Mind you, both of these errors come from the exact same code, but different indices of my structure array (so if I skip past one that causes an issue, another index will cause a different error). Some indices even cause a segmentation violation, which I have opened a ticket for.
I have listed the two errors I have come across below. I can't even tell if these errors are related to one another, or if they are even a problem in my own code or from some MATLAB bug.
In an assignment A(:) = B, the number of elements in A and B must be the same.
Error in trimPolygonToVerticalLine>mergeEnclosedInnerParts (line 266)
ownsInner(k) = owner;
Error in trimPolygonToVerticalLine (line 67)
= mergeEnclosedInnerParts(xOuter, yOuter, xInner, yInner);
Error in trimPolygonToQuadrangle>trimLatitudes (line 135)
lat, lon, latBound, boundType, tolClose);
Error in trimPolygonToQuadrangle (line 47)
[lat, lon] = trimLatitudes(lat, lon, latlim(1), 'lower', tolClose);
Error in applyProjection>applyForward (line 66)
lat, lon, flatlimit, flonlimit, inc);
Error in doApplyProj (line 30)
[x, y, savepts] = mproj.applyForward(mproj, mstruct, in1, in2, objectType);
Error in applyProjection (line 13)
outputs = doApplyProj(mproj, varargin{:});
Error in mercator (line 38)
varargout = applyProjection(mproj, varargin{:});
Error in internal.mapgraph.GeographicContourGroup>projectPolygonFaces (line 251)
[x, y] = feval(mstruct.mapprojection, mstruct, ...
Error in internal.mapgraph.GeographicContourGroup/constructFillPolygon (line 126)
hPolygon = projectPolygonFaces(h.HGGroup, S.Lat, S.Lon, zdata, varargin{:});
Error in internal.mapgraph.ContourGroup/refresh (line 441)
hFill = h.constructFillPolygon(S(k), h.FillZ, props{:}, ...
Error in contourm (line 116)
refresh(h)
Error in contourfm (line 36)
contourm(varargin{:},'Fill','on','DefaultLineColor','black');
Error in smstructplot (line 17)
contourfm(smStruct(icase).lat,smStruct(icase).lon,smStruct(icase).jv,100,'linestyle','none')
And the second error:
Expected one output from a curly brace or dot indexing expression, but there were 2 results.
Error in trimPolygonToVerticalLine>reconnectBrokenRings (line 202)
xcells{kStart} = [xcells{kEnd}(1:(end-1)); xcells{kStart}];
Error in trimPolygonToVerticalLine (line 53)
[xcells, ycells] = reconnectBrokenRings(xcells, ycells, xBound);
Error in trimPolygonToQuadrangle>trimLatitudes (line 135)
lat, lon, latBound, boundType, tolClose);
Error in trimPolygonToQuadrangle (line 48)
[lat, lon] = trimLatitudes(lat, lon, latlim(2), 'upper', tolClose);
Error in applyProjection>applyForward (line 66)
lat, lon, flatlimit, flonlimit, inc);
Error in doApplyProj (line 30)
[x, y, savepts] = mproj.applyForward(mproj, mstruct, in1, in2, objectType);
Error in applyProjection (line 13)
outputs = doApplyProj(mproj, varargin{:});
Error in mercator (line 38)
varargout = applyProjection(mproj, varargin{:});
Error in internal.mapgraph.GeographicContourGroup>projectPolygonFaces (line 251)
[x, y] = feval(mstruct.mapprojection, mstruct, ...
Error in internal.mapgraph.GeographicContourGroup/constructFillPolygon (line 126)
hPolygon = projectPolygonFaces(h.HGGroup, S.Lat, S.Lon, zdata, varargin{:});
Error in internal.mapgraph.ContourGroup/refresh (line 441)
hFill = h.constructFillPolygon(S(k), h.FillZ, props{:}, ...
Error in contourm (line 116)
refresh(h)
Error in contourfm (line 36)
contourm(varargin{:},'Fill','on','DefaultLineColor','black');
Error in smstructplot (line 17)
contourfm(smStruct(icase).lat,smStruct(icase).lon,smStruct(icase).jv,100,'linestyle','none')

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!