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.

采纳的回答

Walter Roberson
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 个)

类别

Help CenterFile Exchange 中查找有关 Just for fun 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by