Info

この質問は閉じられています。 編集または回答するには再度開いてください。

how can I direct a user to the script end script skipping intermediate?

2 ビュー (過去 30 日間)
Jacopo
Jacopo 2014 年 5 月 28 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I have 3 script. The first script performs the calculations for the first layer, the second script for the second layer, the third script for the third layer. Then I quarter script that performs the calculations by taking the values from the three above scripts. But I could have the following cases:
a single layer only two layers three layers
In the first case: I would like to perform calculations only for the first layer and when finished addressing the user directly to the final script, without going through the second and third script.
In the second case I would like to perform calculations only for the first layer and the second and when finished addressing the user directly to the final script, without going through the third script. It was suggested to transform fli script functions but I can not, because they are codes of 1600 lines of data entry.
I want to know: how can I direct a user to the script end script skipping intermediate (second or third) as described above?

回答 (1 件)

Mahdi
Mahdi 2014 年 5 月 28 日
You can easily just add an if statement for the code to only apply based on what you input into it. For example, let's say I have 2 parts to a script and I want to only perform the first part:
SectionToComplete=prompt('Which part of the script do you want to apply?');
# I would input 1 into the command window for example
if SectionToComplete==1
# Do what you want to do here
end
# Second Section
Section2=prompt('Do you want to complete part 2 of the script, 1 for yes, 2 for no')
if Section2==1
# Second Code
end
and so on...
  2 件のコメント
Mahdi
Mahdi 2014 年 5 月 28 日
Note that there are many other ways that you can do this as well and simply using if-statements.
Jacopo
Jacopo 2014 年 5 月 28 日
for example??

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by