How to convert time series table into an array and save as an excell file?

조회 수: 17 (최근 30일)
Piyumal Samarathunga
Piyumal Samarathunga 2023년 2월 18일
답변: Corey Silva 2023년 3월 14일
I have data collected from accelerometers, and that data is saved in a timetable.
I have saved that timetable data as a .mat file.
The data in this .mat file is of the duration data type.
I used the table2array function to convert this table to array.
Following is my code and data set that I used.
load('2023_02_16_F300_NSH_Free_NIacc_data_1.mat', 'NI_Data')
New = table2array(NI_Data)
When I use that function, it indicates that all of my variables as sec values, and data type shows as duration.
How I can convert a time series table into an array as data format as double and how to remove the suffix sec at the end of each data?
Thank you.
  댓글 수: 2
Walter Roberson
Walter Roberson 2023년 2월 19일
https://www.mathworks.com/help/matlab/ref/writetimetable.html ?
Askic V
Askic V 2023년 2월 20일
Wow, it seems that Matlab has a built in function for just about everything that one can need.

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

답변 (2개)

Askic V
Askic V 2023년 2월 18일
편집: Askic V 2023년 2월 18일
I think this code could help you:
%load('2023_02_16_F300_NSH_Free_NIacc_data_1.mat', 'NI_Data')
load(websave('2023_02_16_F300_NSH_Free_NIacc_data_1.mat','https://www.mathworks.com/matlabcentral/answers/uploaded_files/1299495/2023_02_16_F300_NSH_Free_NIacc_data_1.mat'))
New = table2array(NI_Data);
time_sec = seconds(New(:,1));
acc_1 = seconds(New(:,2));
plot(time_sec, acc_1)
Regarding saving into an Excel file, I suggest to look this part of the documentation:
Matlab has an excellent documentation with a lot of examples.

Corey Silva
Corey Silva 2023년 3월 14일
You can use writetimetable to write a timetable to an excel spreadsheet without any conversions needed.

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by