Substracting a number from certain section of the array
Mostrar comentarios más antiguos
I have a number series 8654 elements having data in format (degree) as follows (just an example):
A = [ 1.002 2.003 3.004 4.005 339.006 341.007 342.008 343.009 1.002 2.003 3.004 4.005];
I am currently using the following code to make elements in the above array having values more than 300 substracted by 360;
if (A(:,1) > 300)
A(:,2)= 360-A(:,1);
else
A(:,2) = A(:,1);
end
to make a new array in second coloumn which looks like
A = [ 1.002 2.003 3.004 4.005 21 19 18 17 1.002 2.003 3.004 4.005];
But I am getting the same array as A = [ 1.002 2.003 3.004 4.005 339.006 341.007 342.008 343.009 1.002 2.003 3.004 4.005];
I dont know which place I am going wrong !! Guidance required !!
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Logical en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!