m_mag2geo & m_geo2mag complain of "Attempt to reference field of non-structure array"
3 views (last 30 days)
Show older comments
Hi, This problem persists regardless of the arguments i enter (i.e. which lat and long). The function calls the private m_map function
mc_coords
which hits the error on line 74:
lambda=MAP_PROJECTION.coordsystem.lambda;
Anyone else experience this? Any ideas?
Cheers,
Neil
0 Comments
Accepted Answer
Geoff Hayes
on 15 Nov 2014
Neil - this error message is telling you that the code is treating a variable as if it were a structure with fields when in fact (for whatever reason) it isn't. For example, the following code generates the same error
x = [];
x.test;
Attempt to reference field of non-structure array.
The function in question, mc_coords is assuming that MAP_PROJECTION is a structure with a field named coordsystem. If you look at the code from mc_coords.m, this variable is global
global MAP_PROJECTION MAP_COORDS
If this variable has not been initialized elsewhere then it will be empty (like x in the above example) and so will throw the error. What you need to do is run the m_proj function which will initialize the map projection global variable (and others as well). You will be required to choose the projection type and provide any supporting information.
For example, to use the orthographic projection, type
m_proj('set','Orthographic')
to see what attributes/parameters can be set for this projection. To choose this projection with default values use
m_proj('Orthographic')
To view all projections, type
m_proj('set')
2 Comments
Geoff Hayes
on 16 Nov 2014
Neil - those are good questions and should be directed to the author of the code.
More Answers (0)
See Also
Categories
Find more on Adding custom doc in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!