matlab - How to write a S-function, generating signal of higher than 2 dimensions? -
apparently, unable generate signal of [3x3x3] dimensions:
function test_sf_02(block) % level-2 matlab file s-function. setup(block); function setup(block) % register number of ports , parameters block.numinputports = 0; block.numoutputports = 1; block.numdialogprms = 0; % setup functional port properties dynamically inherited block.setprecompoutportinfotodynamic; % register properties of output port block.outputport(1).samplingmode = 'sample'; %block.outputport(1).dimensionsmode = 'variable'; block.outputport(1).dimensionsmode = 'fixed'; block.outputport(1).dimensions = [3 3 3]; % register sample times % [-1, 0] : inherited sample time block.sampletimes = [-1 0]; % register methods called @ run-time block.regblockmethod('outputs', @outputs); function outputs(block) block.outputport(1).data = zeros(3,3,3);
error occurs @ block.outputport(1).dimensions
assignment , says
cannot set dimensions of output port 1 of 'test_01/level-2 matlab s-function' [3x3x3]. block not setup handle signals of dimensions greater 2 dimensions.
why? saw blocks, generating image frames, i.e. mxnx3
matrices.
update
this not duplicate question.
within setup method need use method
block.allowsignalswithmorethan2d = 1;
this typically done after number of inputs, outputs , parameters defined.
note being source block, simulink prefer specify sample time, not have inherited.
Comments
Post a Comment