read data from .m file
55 次查看(过去 30 天)
显示 更早的评论
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 个评论
Walter Roberson
2016-10-13
fileId = fopen('pfoutput.m');
datacell = textscan(fileId, '*%f|%f/%f*', 'HeaderLines', 3, 'CollectOutput', 1);
fclose(fileId);
opPoints = datacell{1};
atsprink
2016-10-14
awesome...thank you for the help. I was able to make little tweaks to your solution to work as I needed it to.
回答(1 个)
Thomas
2012-1-17
Variables are not stored in .m files as they are ASCII, Variables are usually stored in .mat files that matlab can read.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Other Formats 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!