Filter löschen
Filter löschen

read data from .m file

71 Ansichten (letzte 30 Tage)
zina ben
zina ben am 14 Jan. 2012
Kommentiert: Abishek am 6 Nov. 2023
hi
I want to store different variables in the same .m file,And after I must read these variables one by one. exemple
1
23 3 4
5 6 4
This is contain of .m file.I need to, load this contain, read 1st and 3 rd rows. I hope you help me. thanks
  4 Kommentare
Walter Roberson
Walter Roberson am 13 Okt. 2016
fileId = fopen('pfoutput.m');
datacell = textscan(fileId, '*%f|%f/%f*', 'HeaderLines', 3, 'CollectOutput', 1);
fclose(fileId);
opPoints = datacell{1};
atsprink
atsprink am 14 Okt. 2016
awesome...thank you for the help. I was able to make little tweaks to your solution to work as I needed it to.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Thomas
Thomas am 17 Jan. 2012
Variables are not stored in .m files as they are ASCII, Variables are usually stored in .mat files that matlab can read.
  1 Kommentar
Abishek
Abishek am 6 Nov. 2023
How to read the .m flies

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by