call to a struct
4 views (last 30 days)
Show older comments
hello
I have a structure that is written in one function, how do i sign the struct in the script and than how i call the struct at another function?
this is the function:
function StructPlot( graph,str )
plot(graph.x,graph.y,str);
axis([graph.x(1) graph.x(end) min(graph.y) max(graph.y)])
xlabel(graph.xName);
ylabel(graph.yName);
title('NOISY');
end
the struct in this case is graph, what i write in the struct and what i write in the secound fuction the call to the struct "graph"?
1 Comment
dpb
on 3 Aug 2019
Edited: dpb
on 3 Aug 2019
"a structure that is written in one function,..."
That function doesn't write the struct graph; it expects (in fact requires) a struct to be passed to it when it is called. That struct will have to be created somewhere else and passed to the function StructPlot when called.
Function StructPlot returns nothing; it just consumes the input arguments to create a plot from the contained data.
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!