How can I convert a .txt file to .mat file?

102 ビュー (過去 30 日間)
nivedita r
nivedita r 2015 年 1 月 28 日
回答済み: Momin Shariff 2022 年 6 月 8 日
I have a one dimensional input of floating point values which should be converted to a .mat file. How can i do it?
Example 0.453 0.987 0.7675 0.3478 0.1256 etc....
Is there a possibility of converting it to a .mat file? The .mat file should be usable in simulink.
  1 件のコメント
bilal amjad
bilal amjad 2018 年 7 月 24 日
>> data=importdata('Traindata_0.txt');
>> save('Traindata_0', 'data');
where ('Traindata_0.txt') is my text file containing very large data save ftn save it in .mat file

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

回答 (2 件)

Guillaume
Guillaume 2015 年 1 月 28 日
M = dlmread('somefile.txt'); %Use a better name that M
save('somefile.mat', M);
  3 件のコメント
Kay Ping
Kay Ping 2018 年 6 月 6 日
save('somefile.mat', 'M'); % i took half hour to find out the two ''.... ==
Halil Ibrahim Uluoglu
Halil Ibrahim Uluoglu 2019 年 12 月 17 日
Thank you for solution.

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


Momin Shariff
Momin Shariff 2022 年 6 月 8 日
M = dlmread('somefile.txt'); %Use a better name that M
save('somefile.mat', M);

カテゴリ

Help Center および File ExchangeWorkspace Variables and MAT Files についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by