Port Dimensions error, embedded Matlab/constant block
Port Dimensions error, embedded Matlab/constant block
(OP)
Hi,
I hope you can help. I am trying to set up a test of an imbedded Matlab function I have produced. I have it set up with a series of constant blocks that get their values from an initialisation script.
Whenever I run it, I get the following error:
??? Error using ==> sim
--> Error reported by S-function 'sf_sfun' in 'initTest/chebyInit/chebyInit/ SFunction ':
Errors occurred during parsing of Embedded MATLAB function 'chebyInit/chebyInit'(#161).
--> Error in port widths or dimensions. Output port 1 of
'initTest/chebyInit/chebyInit/chebyTcOrderVec' is a one dimensional vector with 1 elements.
ChebyTcOrderVec is an input port which gets its values from a constant block of the same name and which I would expect to be a 1 dimensional vectore with one element as it just takes in an integer value.
The code for the set up is below, I'm not sure how helpful it will be. All the variables in the script below are then used as constant values from constant blocks. If you need any more information please do let me know as I am stumped and would really appreciate some assistance. Thanks, Robyn
%% Set up Case Specific Values
chebyTcSegStart = 19;
chebyTcSegEnd = 210;
chebyTcOrderSca = 7;
chebyTcOrderVec = 7;
tSwitch = 20.1;
orderMax = 9;
%% Profile 2
% Define the second set of conditions:
% Definition of the arbitary axis:
u2 = [3 0 1];
u2 = u2/norm(u2);
u2 = u2';
%deffinition of the angle (a)
t2 = -1:0.01:1200;
a2 = sin(t2/100);
s2 = cos(a2/2);
u2 = u2* sin(a2/2);
qhist_B = [s2; u2];
qhist_B = qhist_B';
% segStart_B = 200;
% segEnd_B = 1000;
% generate the coefficients
coeff1 =compute_chebychev_coef_v2(t2,qhist_B,1,chebyTcOrderSca+1,chebyTcSegStart,chebyTcSegEnd);
coeff2 =compute_chebychev_coef_v2(t2,qhist_B,2,chebyTcOrderVec+1,chebyTcSegStart,chebyTcSegEnd);
coeff3 =compute_chebychev_coef_v2(t2,qhist_B,3,chebyTcOrderVec+1,chebyTcSegStart,chebyTcSegEnd);
coeff4 =compute_chebychev_coef_v2(t2,qhist_B,4,chebyTcOrderVec+1,chebyTcSegStart,chebyTcSegEnd);
%Define the input values for profile 2
chebyTcCoefSca = coeff1;
chebyTcCoefVec = [coeff2, coeff3, coeff4];
%% run Init Block
sim initTest
I hope you can help. I am trying to set up a test of an imbedded Matlab function I have produced. I have it set up with a series of constant blocks that get their values from an initialisation script.
Whenever I run it, I get the following error:
??? Error using ==> sim
--> Error reported by S-function 'sf_sfun' in 'initTest/chebyInit/chebyInit/ SFunction ':
Errors occurred during parsing of Embedded MATLAB function 'chebyInit/chebyInit'(#161).
--> Error in port widths or dimensions. Output port 1 of
'initTest/chebyInit/chebyInit/chebyTcOrderVec' is a one dimensional vector with 1 elements.
ChebyTcOrderVec is an input port which gets its values from a constant block of the same name and which I would expect to be a 1 dimensional vectore with one element as it just takes in an integer value.
The code for the set up is below, I'm not sure how helpful it will be. All the variables in the script below are then used as constant values from constant blocks. If you need any more information please do let me know as I am stumped and would really appreciate some assistance. Thanks, Robyn
%% Set up Case Specific Values
chebyTcSegStart = 19;
chebyTcSegEnd = 210;
chebyTcOrderSca = 7;
chebyTcOrderVec = 7;
tSwitch = 20.1;
orderMax = 9;
%% Profile 2
% Define the second set of conditions:
% Definition of the arbitary axis:
u2 = [3 0 1];
u2 = u2/norm(u2);
u2 = u2';
%deffinition of the angle (a)
t2 = -1:0.01:1200;
a2 = sin(t2/100);
s2 = cos(a2/2);
u2 = u2* sin(a2/2);
qhist_B = [s2; u2];
qhist_B = qhist_B';
% segStart_B = 200;
% segEnd_B = 1000;
% generate the coefficients
coeff1 =compute_chebychev_coef_v2(t2,qhist_B,1,chebyTcOrderSca+1,chebyTcSegStart,chebyTcSegEnd);
coeff2 =compute_chebychev_coef_v2(t2,qhist_B,2,chebyTcOrderVec+1,chebyTcSegStart,chebyTcSegEnd);
coeff3 =compute_chebychev_coef_v2(t2,qhist_B,3,chebyTcOrderVec+1,chebyTcSegStart,chebyTcSegEnd);
coeff4 =compute_chebychev_coef_v2(t2,qhist_B,4,chebyTcOrderVec+1,chebyTcSegStart,chebyTcSegEnd);
%Define the input values for profile 2
chebyTcCoefSca = coeff1;
chebyTcCoefVec = [coeff2, coeff3, coeff4];
%% run Init Block
sim initTest