I have problem with saving data in loop
I'd like to seperate lon and lat which are saved in num
lon is saved num(1), num(3),num(5)......, and lat is num(2),num(4),num(6)......
That is my code and num
num=xlsread('ENVISAT.ex.xlsx');
num=num(~isnan(num));
num=nonzeros(num)
i=0
lon=[];
lat=[];
for i=1:30
i=i+um
lon=num(i+1)
lat=num(2*i+1)
end

 Respuesta aceptada

Rik
Rik el 9 de Oct. de 2021

0 votos

No loop required:
num=xlsread('ENVISAT.ex.xlsx');
num=num(~isnan(num));
num=nonzeros(num);
lon=num(1:2:end);
lat=num(2:2:end);
In your code it was overwriting the variable every iteration, instead of indexing.

1 comentario

il147
il147 el 9 de Oct. de 2021
It works!!!!!!!!
You are the best :) Thanks!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 9 de Oct. de 2021

Comentada:

el 9 de Oct. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by