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 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
Walter Roberson
on 11 Jul 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 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!