I need help on how to save a data file

3 ビュー (過去 30 日間)
AStar
AStar 2019 年 11 月 25 日
コメント済み: Image Analyst 2019 年 11 月 27 日
Tamika Jones,A,+,130,70
Helen Dee,B,-,140,80
Dale Kale,AB,-,125,60
Emma Stone,O,+,120,65
I need help on how to save this as a .dat file. When I do
save bloodinfo.dat
and then do
type bloodinfo
it is not there.
How can I save this file?
  3 件のコメント
per isakson
per isakson 2019 年 11 月 27 日
編集済み: per isakson 2019 年 11 月 27 日
Your example looks like the content of a text file. Is it? Inside Matlab this "info" may be stored in a cell array or maybe a table. How is it stored?
"do save bloodinfo.dat" Exactly how did you do that?
Image Analyst
Image Analyst 2019 年 11 月 27 日
Original question below, in case he deletes this one also, like he has before in other threads:
Tamika Jones,A,+,130,70
Helen Dee,B,-,140,80
Dale Kale,AB,-,125,60
Emma Stone,O,+,120,65
I need help on how to save this as a .dat file. When I do
save bloodinfo.dat
and then do
type bloodinfo
it is not there.
How can I save this file?

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

回答 (1 件)

Image Analyst
Image Analyst 2019 年 11 月 27 日
Try this
fid = fopen('bloodinfo.dat', 'wt');
for k = 1 : length(value1)
fprintf(fid, '%s, %s, %d, %d\n', patientName{k}, bloodtype{k}, value1(k), value2(k))
end
fclose(fid);
type('bloodinfo.dat');
Obviously replace the variables with whatever your variables are named.

カテゴリ

Help Center および File ExchangeLow-Level File I/O についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by