フィルターのクリア

read from a txt file

1 回表示 (過去 30 日間)
Alexandros
Alexandros 2011 年 11 月 25 日
I have a txt file that looks like
time1,system1,system2,system3
[sec],[m],[m],[m]
1 AM, 1,2,3
2 AM, 1,2,3
3 AM, 1,2,3
I want to take that into matlab and then transfer it to excel every cell under it
By doing
dir = fopen(text.txt)
D = textscan(dir, '%s %s %s %s', 'delimited', ',')
I get a 4 cell arrays which includes all the data. so cell 1 has all the colum for time 1, cell 2 all the column for system1 e.t.c
when i do xlswrite (test.xls, D, 1, 'A1') it doesn't want to paste it
Do you have any ideas? I could use the dlmread function (only for numerical data) but i really need to paste also the time1 column with AM or without AM i don't care. But dlmread doesnt work if there is text in there and it colides with AM
Any ideas Thank you
  1 件のコメント
Jan
Jan 2011 年 11 月 25 日
Instead of "it doesn't want to paste it" a copy of the error message would be more helpful. Do you have problems with the file name -forgot the quotes?- or with the data in D -no nested cells allowed-?

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

採用された回答

Jan
Jan 2011 年 11 月 25 日
E = cat(2, D{:});
xlswrite('test.xls', E, 1, 'A1');
  1 件のコメント
Alexandros
Alexandros 2011 年 11 月 25 日
This is exactly what I needed.
Thank you so much

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by