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

97 Ansichten (letzte 30 Tage)
nivedita r
nivedita r am 28 Jan. 2015
Beantwortet: Momin Shariff am 8 Jun. 2022
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 Kommentar
bilal amjad
bilal amjad am 24 Jul. 2018
>> 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

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Guillaume
Guillaume am 28 Jan. 2015
M = dlmread('somefile.txt'); %Use a better name that M
save('somefile.mat', M);
  3 Kommentare
Kay Ping
Kay Ping am 6 Jun. 2018
save('somefile.mat', 'M'); % i took half hour to find out the two ''.... ==
Halil Ibrahim Uluoglu
Halil Ibrahim Uluoglu am 17 Dez. 2019
Thank you for solution.

Melden Sie sich an, um zu kommentieren.


Momin Shariff
Momin Shariff am 8 Jun. 2022
M = dlmread('somefile.txt'); %Use a better name that M
save('somefile.mat', M);

Kategorien

Mehr zu Workspace Variables and MAT Files finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by