フィルターのクリア

one column in to multiple column

6 ビュー (過去 30 日間)
Amila
Amila 2022 年 10 月 7 日
編集済み: Image Analyst 2022 年 10 月 8 日
I have a .mat data file (results.mat). The first five columns are the date and time like yyyy, mm,dd,mm.
The 12th column has the data I need Results(:,12).
I wanted to use date (dt4) to split the column in to multiple columns:
dt4 =datetime(Results(:,1),Results(:,2), Results(:,3),0,0,0);
I tried to use
newtable = reshape(Results(:,12), 157, []);
then I realized that some days have different amount of data.
I want the date as column name. Could you kindly help me? I am new to MATLAB.
  1 件のコメント
Image Analyst
Image Analyst 2022 年 10 月 8 日
編集済み: Image Analyst 2022 年 10 月 8 日
You forgot to attach results.mat!
Perhaps use addvars.
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:

サインインしてコメントする。

回答 (1 件)

dpb
dpb 2022 年 10 月 8 日
It's not possible to have a table with different number or rows by variable(column); MATLAB is NOT a spreadsheet (which is agoodthing™).
It is also generally better to keep data as fields and use the field values as grouping or selection variables than to break up into different variables and then have to try to recombine to do something with.
Attach the data as a .mat file and describe what you're trying to accomplish and somebody's bound to have a way to approach it "the MATLAB way".

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by