フィルターのクリア

Writing a txt file via matlab

1 回表示 (過去 30 日間)
Davin
Davin 2014 年 11 月 24 日
コメント済み: Davin 2014 年 11 月 24 日
Hello,
I want to write a txt file via matlab, with a '.tck' extension instead of txt
I have the following :
b =
'BKY' 'DIS' 'KIY'
Then
fileID = fopen('ko.tck','wt')
I do get a fileID.
Then I want to transfer the content of b to the file
fprintf(fileID,'%s\n',b)
I get the following error :
Error using fprintf
Function is not defined for 'cell' inputs.
Do you know how to get these strings in a list form in my .tck file?
Thank you
D

回答 (1 件)

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 11 月 24 日
b={'BKY' 'DIS' 'KIY'}
fileID = fopen('ko.tck','wt')
fprintf(fileID,'%s\n',b{:})
fclose(fileID)
  1 件のコメント
Davin
Davin 2014 年 11 月 24 日
Hello Azzi,
Thanks for your answer. But I dont get the export of the file ko.tck, in fact i get this :
b =
'BKY' 'DIS' 'KIY'
fileID =
5
ans =
12
ans =
0
thanks
I tested with .txt too but dont work too and also with 'w' instead of 'wt'
D

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

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by