call to a struct

4 ビュー (過去 30 日間)
Idan Benzur
Idan Benzur 2019 年 8 月 3 日
編集済み: dpb 2019 年 8 月 3 日
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 件のコメント
dpb
dpb 2019 年 8 月 3 日
編集済み: dpb 2019 年 8 月 3 日
"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.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeStructures についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by