Function not returning the desired structure
4 views (last 30 days)
Show older comments
When testing my function to build a structure based on a .dat file, the output shows the desired struct 'kepler' but seems to overwrite with the same size struct 'ans.' Why is it doing this, and how can I fix it?
function kepler = loadkepler(filename)
data = load(filename);
kepler.svid = data(1:end,1);
kepler.meananomaly = data(1:end,2);
kepler.omega = data(1:end,3);
kepler.radius = data(1:end,4);
kepler.inclination = data(1:end,5);
kepler.reftime = data(1:end,6);
end
When I test it with just the 'svid' field, this is the output:
>> loadkepler
kepler =
struct with fields:
svid: [24×1 double]
ans =
struct with fields:
svid: [24×1 double]
Attempts to build a bar graph only work if I use 'ans.svid' instead of 'kepler.svid'
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Structures 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!