如何在MATLAB Function中获取工作区变量? [英] How can I get workspace variables in MATLAB Function?

查看:3129
本文介绍了如何在MATLAB Function中获取工作区变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在simulink代码中使用Matlab函数,在其中我使用load命令从工作空间中获取一些矩阵和变量

I am using Matlab function in my simulink code where I am using the load command for getting some matrices and variables from the workspace

persistent ProblemParams;
if isempty(ProblemParams)
    ProblemParams = load('ProblemParams.mat');
end

这很好用,但是当我同时运行多个仿真时可能会出现问题,因此我想知道我还需要哪些其他选项将数组从MATLAB工作区传递给此块吗?

This is working well, however there can be problem when I am running multiple simulations at the same time, hence I would like to know what other options do I have to pass an array to this block from MATLAB workspace?

推荐答案

无论上述方法是否奏效,都不是将数据放入块中的正确方法.您应该在开始模拟之前将变量加载到MATLAB Workspace中,然后将变量作为

Whether or not the above works, it's not the right way to get data into the block. You should load the variable into the MATLAB Workspace prior to starting the simulation, then pass the variable into the MATLAB Function Block as a Parameter Argument.

这篇关于如何在MATLAB Function中获取工作区变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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