call to a struct

4 visualizaciones (últimos 30 días)
Idan Benzur
Idan Benzur el 3 de Ag. de 2019
Editada: dpb el 3 de Ag. de 2019
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 comentario
dpb
dpb el 3 de Ag. de 2019
Editada: dpb el 3 de Ag. de 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.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Structures en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by