Unable to perform assignment because the size of the left side is 7-by-1 and the size of the right side is 7-by-7
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Sim
il 11 Lug 2020
Commentato: Walter Roberson
il 11 Lug 2020
Hi, I would like to pass some extra arguments to my ODE as follows:
[T,H] = ode23t(@(t,h) MYODE(t,h,G,N,e,n,z,initialnode,w,Qcell,lambda), tspan, h0, opts);
[~,Qcell] = cellfun(@(t,h) MYODE(t,h,G,N,e,n,z,initialnode,w,Qcell,lambda), num2cell(T), num2cell(H,2), 'uni',0);
but I get this error:
Unable to perform assignment because the size of the left side is 7-by-1 and the size of the right side is 7-by-7.
Any idea on how to fix it?
0 Commenti
Risposta accettata
Walter Roberson
il 11 Lug 2020
The boundary conditions, h, will always be passed to the function as a column vector even if you initialize as a row vector. Your extra arguments have at least one row vector that you are combining elementwise with h thinking that h is a row vector. But because it is a column vector you are getting implicit expansion, as if you had used bsxfun.
Review your code and ensure that you have the right orientation for all your inputs taking into consideration that h will be received as a column vector.
2 Commenti
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!