call to a struct
조회 수: 4 (최근 30일)
이전 댓글 표시
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
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 Exchange에서 Structures에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!