synchronization of matlab function blocks
显示 更早的评论
Dear all, I have a simulink model who contains 9 subsystems connected to each other via GoTo-From blocks, each subsystem has a matlab function block (should be the same block, I just copy past from the first subsystem to the other subsystems), my question is regarding the matlab function block, I need to change some variables inside the matlab function in the subsystem number one these variables should be changed instantly in the other blocks as well, I was looking for a way to define the matlab function block to be global or on other words how can I tell the simulink that this matlab function block is the same block in all subsystems so any change in any block either adding a code or updating variables during the simulation time will be instantly applied to the other blocks.
Also I have a question regarding the output of the matlab function block, can this output be treated as an array instead of separated values? The matlab function block code is :
function [UB11,UB12,UB13,UB21,UB22,UB23,UB31,UB32,UB33,I] = fcn %coder.extrinsic('fcn') coder.extrinsic('xlsread'); persistent U; U=zeros(3,3); U=xlsread('C:\Users\Documents\MATLAB\InputImage.xlsx'); UB11=U(1,1); UB12=U(1,2); UB13=U(1,3); UB21=U(2,1); UB22=U(2,2); UB23=U(2,3); UB31=U(3,1); UB32=U(3,2); UB33=U(3,3); I=1; Thank you in advance, Sali
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Programmatic Model Editing 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!