Why am I getting the error, "Array indices must be positive integers or logical values."

1 visualizzazione (ultimi 30 giorni)
slice=1;
squeeze(vxtmp(:,slice,:))=squeeze(vx(:,slice,:)).*squeeze(magmask(:,slice,:)).*(1-squeeze(BVM(:,slice,:)));

Risposta accettata

Jan
Jan il 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,:));

Più risposte (1)

Image Analyst
Image Analyst il 11 Apr 2021

Categorie

Scopri di più su Matrices and Arrays in Help Center e File Exchange

Tag

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by