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에서 MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by