How to return to a pormpt-input line and continue from there a sequence of functions, for multiple time?

1 visualización (últimos 30 días)
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.

Respuesta aceptada

Walter Roberson
Walter Roberson el 25 de Jul. de 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

Más respuestas (0)

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by