NaN problem with xlsread

2 visualizaciones (últimos 30 días)
Utsav
Utsav el 25 de En. de 2016
Editada: Utsav el 25 de En. de 2016
My code :
[Day, txt_day, raw_day] = xlsread('file.xlsx',1,'A:A');
[Paramet, txt1, raw1] = xlsread('file.xlsx',1,'F:F');
file.xlsx has Day in A column, Paramet in F.
For some day in A, some entries in F in NaN.........
I wish to plot(A,Paramet), but Paramet has lesser rows than Day, as NaN's in F are not recognized by xlsread.
I wish to plot all Day of A column, and NaN as blanka at appropriate X values
Any help.

Respuesta aceptada

Utsav
Utsav el 25 de En. de 2016
Idea is to find character assign NaN and replace NaN values to Matrix
ival = cellfun(@ischar,raw1);
raw1(ival) = {NaN};
Paramet_1 = cell2mat(raw1);
Paramet_2=Paramet_1(2:(numel(Day)+1),:);
Paramet_2 contains my required datasets
Thanks Laura.Thanks Mathworks.

Más respuestas (1)

Walter Roberson
Walter Roberson el 25 de En. de 2016
all_day = cell2mat(raw_day);
num_day = length(all_day);
all_Paramet = cell2mat(raw1);
num_Paramet = length(all_Paramet);
if num_Paramet < num_day
all_Paramet(end+1:num_day) = NaN;
elseif num_day < num_Paramet
all_day(end+1:num_Paramet) = NaN;
end
plot(all_day, all_Paramet)
  1 comentario
Utsav
Utsav el 25 de En. de 2016
Editada: Utsav el 25 de En. de 2016
Thanks Walter for the help...........

Iniciar sesión para comentar.

Categorías

Más información sobre Data Distribution Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by