如何连接Matlab脚本 [英] How to connect matlab scripts

查看:132
本文介绍了如何连接Matlab脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下问题: 我已经编写了六个脚本matlab.在第一个脚本中,用户必须输入变量n_strati(介于1到5之间的数字).第一个脚本使您可以基于已知或未知变量来选择计算模型,并将其运行到n_strato = 1.第二,第三,第四和第五脚本分别针对第2-3-4-5层遵循相同的过程,但是其中输入参数(无意作为值)不同.例如:

I have the following problem: I have written six scripts matlab. In the first script, the user must enter the variable n_strati (a number between 1 and 5). The first script allows you to make choices about computing models based on variables known or unknown , and runs them to n_strato=1. The second third fourth and fifth script follow the same procedure , respectively, for the layers 2-3-4-5, but in which the input parameters (not intended as a value) are different. For example:

对于Strato1,执行已知输入变量A B E(而不是C D F)的计算;对于Strato2,执行已知知道A C E(而不是B D F)的计算;对于Strato3,则了解变量B D F(而不是A C E).

for Strato1 performs calculations knowing the input variables A B E (and not C D F) , for Strato2 performs calculations knowing A C E (and not B D F) , for Strato3 knowing the variables B D F (and not A C E).

第六个函数获取先前脚本的所有变量,并对它们进行处理以获得最终结果. 前五个脚本使用以下命令保存数据:

The sixth takes all the variables of the previous scripts and processes them to obtain the final result. The first five scripts save the data using the command:

save Strato1 alpha beta gamma
% etc.

和第六个脚本,它们使用以下命令存储":

and the sixth script them "stores" with the command:

load Strato1
load Strato2
% etc.

但是我必须确保:

如果n_strati == 1 我输入数据并在script1跳跃脚本2-3-4-5中选择模型,并通过脚本6进行最终计算.

if n_strati==1 I enter the data and choose the models in script1 jumping scripts 2-3-4-5 and proceeding with the final calculation through the script 6 .

如果n_strati == 2 我输入数据,并在脚本1中选择Strato1的模型,在脚本2中选择Strato2的模型,跳过脚本3-4-5,并通过脚本6进行最终计算. 等等.

if n_strati==2 I enter the data and choose the models for Strato1 in script1 and Strato2 in script2 jumping scripts 3-4-5 and proceeding with the final calculation through the script 6 . and so on.

我想知道:我该怎么办?

I wanted to know: how can I do?

谢谢您的合作.

推荐答案

最好的方法是避免使用脚本并使用函数.即使您成功使用多个脚本,这些代码也将是一团糟,难以调试等.因此答案很简单:

The best way would be avoiding scripts and using functions. Even if you succeed in your plot of using multiple scripts, the code will be a big mess, hard to debug, etc. So the answer is simple:

对脚本说不!

这就像添加签名并声明您的输入和输出一样简单.

It is as easy as adding a signature and declaring your input and output.

这篇关于如何连接Matlab脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆