How to return to a pormpt-input line and continue from there a sequence of functions, for multiple time?
1 回表示 (過去 30 日間)
古いコメントを表示
I have a huge matrix like [800k 6]. I have written a script that load the data and extract some part of that. The script are composed of several functions and some prompt-input lines. Since the input data is large; I want to import the data in the first place and then return (go back) to a certain line in the script to do same process and extract the next output data-set. I tried the combination of 'return' and 'switch' but since Matlab's help about 'return' was not helpful, at least for me, I couldn't find my way. My code is like
fun 1 % importing data
fun 2
pormpt-input 1 % asking question about which data should be extracted
fun 3
fun 4
fun 5 % writing extracted data to a file
prompt-input 2 % asking question about continuing the extraction
In the above script I want to go back to the line pormpt-input 1 and continue it to the end of the code, for multiple time.
Could some one help me to go through this problem? Thank you.
0 件のコメント
採用された回答
Walter Roberson
2015 年 7 月 25 日
fun 1 % importing data
fun 2
should_continue = true;
while should_continue
prompt-input 1 % asking question about which data should be extracted
fun 3
fun 4
fun 5 % writing extracted data to a file
prompt-input 2 % asking question about continuing the extraction
should_continue = strcmpi(Input2, 'Y');
end
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!