NaN problem with xlsread

2 Ansichten (letzte 30 Tage)
Utsav
Utsav am 25 Jan. 2016
Bearbeitet: Utsav am 25 Jan. 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.

Akzeptierte Antwort

Utsav
Utsav am 25 Jan. 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.

Weitere Antworten (1)

Walter Roberson
Walter Roberson am 25 Jan. 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 Kommentar
Utsav
Utsav am 25 Jan. 2016
Bearbeitet: Utsav am 25 Jan. 2016
Thanks Walter for the help...........

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Data Distribution Plots finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by