Please help with my function that is to read files.
Afficher commentaires plus anciens
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.
Réponses (1)
Star Strider
le 20 Juil 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 commentaires
pudje
le 20 Juil 2016
Star Strider
le 20 Juil 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);
Catégories
En savoir plus sur Spreadsheets dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!