call to a struct
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentar
dpb
am 3 Aug. 2019
Bearbeitet: dpb
am 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.
Antworten (0)
Siehe auch
Kategorien
Mehr zu Structures finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!