The code works but it gives this warning. How to remove this warning?
Ältere Kommentare anzeigen
In the attachment, run the "main.m" file. It works but it continuiusly gives the following warning types:
Warning: Integer operands are required for colon operator when used as index.
> In L2_Array (line 14)
In monoWithArrayByAskic1 (line 9)
In main>@(b)monoWithArrayByAskic1(b,u) (line 16)
In fpa1 (line 36)
In main (line 16)
How to remove these warnings?
Akzeptierte Antwort
Weitere Antworten (1)
Jan
am 3 Mär. 2023
You call the function L2_Array in ByAskic.m with the arguments 6 and 10.
Inside L2_Array you calculate
N_on_each_axis = (N-1)/3;
r = zeros(3*N_on_each_axis+1,3);
v = (N_on_each_axis*d:-d:d).';
r(2:N_on_each_axis+1,1) = v;
r(N_on_each_axis+2:2*N_on_each_axis+1,2) = v;
For N=6 and 10, N_on_each_axis is 5/3 and 3. In the first case, this is not an integer and as the error message tells you, this is not valid for indexing. Indices must be positive integers.
Kategorien
Mehr zu Multidimensional Arrays finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!