Please help with my function that is to read files.
Show older comments
function readd(txxt)
data = dlmread(txxt, '', 43, 0);
mass = data(:, 3);
temp = data(:, 2);
time = data(:, 1);
end
This is what it returns in the cmd window:
Not enough input arguments.
Error in untitled7 (line 4) data = dlmread(txxt, '', 43, 0);
I've tried setting the left hand side of the function equal to: [data] [mass,temp,time]
Nothing worked.
Answers (1)
Star Strider
on 20 Jul 2016
Guessing here, but '' is an empty string. If you want to specify a space, put a space between the quotes.
See if this works:
data = dlmread(txxt, ' ', 43, 0);
2 Comments
pudje
on 20 Jul 2016
Star Strider
on 20 Jul 2016
You cannot run a function by simply clicking ‘run’. You have to use it in a command:
txxt = 'file.txt';
readd(txxt)
Of course it is not going to return anything to your workspace. To do that, you need to specify it as:
function [mass,temp,time] = readd(txxt)
then call it as:
txxt = 'file.txt';
[mass,temp,time] = readd(txxt);
Categories
Find more on Standard File Formats in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!