How to return to a pormpt-input line and continue from there a sequence of functions, for multiple time?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Ali Y.
am 25 Jul. 2015
Kommentiert: Ali Y.
am 25 Jul. 2015
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 Kommentare
Akzeptierte Antwort
Walter Roberson
am 25 Jul. 2015
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
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!