How can I get workspace variables in MATLAB Function?

南笙酒味 提交于 2020-02-25 05:23:17

问题


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

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?


回答1:


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.



来源:https://stackoverflow.com/questions/25698529/how-can-i-get-workspace-variables-in-matlab-function

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!