Info

This question is closed. Reopen it to edit or answer.

Simulink user defined function: Subscripted assignment dimension mismatch

1 view (last 30 days)
Dear all,
When using a user defined Matlab function in Simulink, with the following structure:
function [G_pv, G_dpv] = poa_SL(G_bh,G_dh,t,t_Matrix,alpha_pv,gamma_pv,Koordinaten,Zeitzone)
Jahrestage.Jahre= [1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004]
Jahrestage.Tage= [365 365 366 365 365 365 366 365 365 365 366]
Zeiger_Jahrestage=find(Jahrestage.Jahre==t_Matrix(1,1));
n_Jahrestage=Jahrestage.Tage
Zeiger_Jahrestage);
[t_s,~,IC]=unique(floor(t));
% Verkürzter doy
doy_s=[1:n_Jahrestage]';
% Langer doy
doy=doy_s(IC);
% Länge von t
le=length(t);
ly=zeros(le,1);
ly(1:le,1)=n_Jahrestage;
...
end
I get the error: Subscripted assignment dimension mismatch (size [1 x 1] ~= size [1 x Confused]) .
As you can see the error occurs when I want to assign a value from the variable n_Jahrestage to the variable ly. I guess the error has to with the fact that matlab does not identify the size of n_Jahrestage ( see MATLAB Function Report Screenshot ).
Can anyone help?

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!