Subscripted assignment dimension mismatch error
1 view (last 30 days)
Show older comments
Alexandra Roxana
on 22 Oct 2021
Commented: Alexandra Roxana
on 23 Oct 2021
I'm having this error and unfortunately I can't seem to see what's wrong in it. Here are the dimension of the variables:
ki=150, a=0, b=2, hx=0.1818, c=0, d=5, hy=0.3125, pi=150x1 double
Thank you in advance!
figure(1)
U(1:ki,1:ki)=pi;
[X,Y]=meshgrid(a:hx:b,c:hy:d);
surf(X,Y,U');
0 Comments
Accepted Answer
Dave B
on 22 Oct 2021
When you write:
U(1:ki,1:ki)=pi;
You're trying to put a 150x1 into a 150x150...Maybe what you intended was:
U(1:ki,1:ki)=repmat(pi,1,150);
It's a little unclear what you're after, but if you want to assign to a 150x150 you should probably give it a 150x150
4 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!