Why am I getting the error, "Array indices must be positive integers or logical values."
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Gabriel Fuhrman
il 10 Apr 2021
Commentato: Gabriel Fuhrman
il 13 Apr 2021
slice=1;
squeeze(vxtmp(:,slice,:))=squeeze(vx(:,slice,:)).*squeeze(magmask(:,slice,:)).*(1-squeeze(BVM(:,slice,:)));
0 Commenti
Risposta accettata
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)
Vedere anche
Categorie
Scopri di più su Matrices and Arrays in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!