.mat file to .txt file

7 ビュー (過去 30 日間)
Alexis Thompson
Alexis Thompson 2020 年 8 月 18 日
編集済み: per isakson 2020 年 8 月 21 日
I have a .ns5 data file that I want to convert to a .txt file to analyze the data. It is a very large data file (32x 180028044int16) so ive broken it down into 7 samples that are one minute in length (sample 1-7) only with data from channel 2 making each sample 1x1800001int16. I have attached a picture of what my workspace and editor look like from my input. How do i save each sample (1-7) as a .txt file? If i right click them in the workspace right now they only save as a .mat file or .m, but in order for me to analyze the data it needs to be in a .txt file format to be entered into another code.

回答 (1 件)

per isakson
per isakson 2020 年 8 月 20 日
編集済み: per isakson 2020 年 8 月 20 日
A little demo
>> i16 = ones( 12, 1, 'int16' ); % sample data
>> fid = fopen('i16.txt','a');
>> fprintf( fid, '%6d\n', i16 );
>> fclose(fid);
>> type i16.txt
1
1
...
  2 件のコメント
Alexis Thompson
Alexis Thompson 2020 年 8 月 20 日
In the first line where you write i16, is that where I would put the name of the file I am trying to convert?
per isakson
per isakson 2020 年 8 月 21 日
編集済み: per isakson 2020 年 8 月 21 日
No, i16 is the variable that you want to print to the txt-file. Thus, skip the first line and replace i16 by sample1, etc. in the following lines. And skip the last line.
"sample (1-7) as a .txt file" Does that mean ONE txt-file?

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

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by