필터 지우기
필터 지우기

How show/plot data from struct

조회 수: 1 (최근 30일)
Agnes Palit
Agnes Palit 2018년 7월 14일
편집: Agnes Palit 2018년 7월 16일
I am trying to show data, by using this code:
n = length(patient_1_e.patient_1);
figure;
for i = 1:n
if (contains(patient_1_e.patient_1(i).Name, 'SM_dayOverview_day') == 1)
% put the field data inside the new variable
process(i).Name = patient_1_e.patient_1(i).Name;
process(i).Data = patient_1_e.patient_1(i).Data;
if isempty(process(i).Name) ~= 1
disp("nih")
process(i).Data{:,1} = datetime(process(i).Data{:,1}, 'InputFormat' ,'dd-MMM yyyy');
% plot (process(i).Data{:,1}, process(i).Data{:,11});
end
end
end
But I got this error:
Error using datetime (line 616)
Unable to parse date/time text using the format 'dd-MMM yyyy'. If the date/time text contain day, month, or time zone
names in a language foreign to the 'en_US' locale, those might not be recognized. You can specify a different locale
using the 'Locale' parameter.
Error in Main (line 39) process(i).Data{:,1} = datetime(process(i).Data{:,1}, 'InputFormat' ,'dd-MMM yyyy');
this is the content of the data "patient_1_e.patient_1(1).Data":
Any idea how to solve this?
  댓글 수: 1
dpb
dpb 2018년 7월 14일
Attach a .mat file with a small(ish) subset of the data...it's not evident to me where the error is from just scanning the code but w/o the actual data structure it's tough. One would guess one could avoid the looops and all, but need to see the actual structure.

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2018년 7월 14일
Your Data{:,1} is 'Wed', which is not in the input format 'dd-MMM yyyy'
I showed you how to input these dates in your previous Question, and I am waiting for your response to what I asked in https://www.mathworks.com/matlabcentral/answers/408846-import-csv-data-into-matlab?s_tid=prof_contriblnk#comment_585882

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Text Data Preparation에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by