From: ashish pande on 1 Jan 2010 18:35 Hi, I"m trying to get a vector complex output from my S-function. It seems that level-1 M file can't output a complex vector. Hence I'm using level-2 M file. However, I'm getting the error message as "Error in 'SetOutputPortDimensions' method of 'XXXX/Level-2 M-file S-Function'. The dimensions of output port 0 should have been set to [1], but was instead set to [2]." My code is as follows. Please help me out. If there is a way to do get complex vector output in level-1 file, pls. let me know. function bls_rentian_s2(block) setup(block); function setup(block) block.NumDialogPrms = 4; % Register number of ports block.NumInputPorts = 1; block.NumOutputPorts = 1; block.OutputPort(1).Complexity = 'c'; block.SampleTimes = [0 0]; block.RegBlockMethod('SetOutputPortDimensions', @SetOutPortDims); block.RegBlockMethod('Outputs', @Outputs); function SetOutPortDims(block, idx, di) block.OutputPort(1).Dimensions = 2;%di;%[1,2]; % block.InputPort(1).Dimensions = di; function Outputs(block) n2 = block.DialogPrm(1).Data; n3 = block.DialogPrm(2).Data; lambda = block.DialogPrm(3).Data; h = block.DialogPrm(4).Data; n1 = 1; pi = 3.14; r_12 = (n1-n2)/(n1+n2); r_23 = (n2-n3)/(n2+n3); delta = 4*pi*n2*h/lambda; block.OutputPort(1).Data = [r_12;r_23];
|
Pages: 1 Prev: Trading Days & Business Days: When were they? Next: smes unit |