Assigning a script to a variable
古いコメントを表示
Hello,
I have a program that uses input data generated by a script file. There are several different script files that I can use. I want to assign the script to a variable so I can call it in my program.
A simplified version of what I have right now is:
system=input('Which data set is being used?\n');
if system==1
DTSsys_Ieee_rvc;
elseif system==2
Pf4busHw_Ieeerv;
end
This works, but I end up calling these scripts several times in my program, and I have more than 2 systems. So I have these long if-else statements several times in my program whenever I want to reinitialize my input data. Is it possible to shorten my code with something like:
system=input('Which data set is being used?\n');
if system==1
inputData=DTSsys_Ieee_rvc;
elseif system==2
inputData=Pf4busHw_Ieeerv;
end
So that I can just call 'inputData' whenever I need to reinitialize my inputData?
Thanks for the help
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Get Started with MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!