Why am I getting the error, "Array indices must be positive integers or logical values."
1 view (last 30 days)
Show older comments
slice=1;
squeeze(vxtmp(:,slice,:))=squeeze(vx(:,slice,:)).*squeeze(magmask(:,slice,:)).*(1-squeeze(BVM(:,slice,:)));
0 Comments
Accepted Answer
Jan
on 11 Apr 2021
What is "squeeze"? Did you shadow the function by defining it as variable?
The left hand side of an assignment cannot be a function. So the squeeze on the left creates a variable, such that following executions do not use the function "squeeze" anymore, but the array created before.
I assume, you can fix and simplify your code by:
vxtmp(:,slice,:) = vx(:,slice,:)) .* magmask(:,slice,:) .* (1 - BVM(:,slice,:));
More Answers (1)
See Also
Categories
Find more on Matrices and Arrays in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!