フィルターのクリア

Function within a for?

1 回表示 (過去 30 日間)
lightworks
lightworks 2013 年 4 月 4 日
Hi,
I made a function that makes a plot with 2 parameters: graph.m. This works fine, but the problem is that I need to do the same graph within a loop. This is what I have (simplified):
idest=[10046,10100,10105];
stid=[{'Zavalla'};{'Corboba Aero'};{'Cordoba Observatorio'}];
for k=1:size(idest,2);
load (['./rec' num2str(idestaciones(k)) '.mat']);
graph(X,Y);
end
where the files that load contain the matrix or the data for building the matrix that goes in the input of the graph function (ie matrix X and Y)
The issue is that graph.m is dependant of the 'k' position in the for, since it gives the number of code and title that should be printed in the plot. So when I run the script which includes the function graph, I get this error:
??? Undefined function or variable 'k'.
I have no idea how to fix this.. any ideas??
I hope I made myself clear. Please tell me if I should add the graph script or others!

採用された回答

the cyclist
the cyclist 2013 年 4 月 4 日
Can you just pass the k parameter in, too?
graph(X,Y,k)
You'll need to modify the function, too, something like
function [] = graph(X,Y,k)
presumably.

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by