Creating a function to read a text file
2 次查看(过去 30 天)
显示 更早的评论
What is wrong with this code? I just want to parse a text file, and sort it into desperate arrays.
function [mass] = read(filex)
a = dlmread(filex);
mass = a(:, 3);
temp = a(:, 2);
time = a(:, 1);
end
1 个评论
Walter Roberson
2016-7-15
You do not indicate what problem you are encountering.
Your code should do something useful if you pass it a string which is the name of a text file that has no headers and which is comma or tab delimited.
回答(1 个)
Azzi Abdelmalek
2016-7-15
function [mass,temp,time] = read(filex)
a = dlmread(filex);
mass = a(:, 3);
temp = a(:, 2);
time = a(:, 1);
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Characters and Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!