not enough input arguments

5 visualizaciones (últimos 30 días)
Haleema Ahsan
Haleema Ahsan el 20 de En. de 2020
Respondida: Guillaume el 20 de En. de 2020
i have the following code
function importfile(fileToRead1)
%IMPORTFILE(FILETOREAD1)
% Imports data from the specified file
% FILETOREAD1: file to read
% Auto-generated by MATLAB on 20-Jan-2020 16:22:01
% Import the file
newData1 = load('-mat', fileToRead1);
% Create new variables in the base workspace from those fields.
vars = fieldnames(newData1);
for i = 1:length(vars)
assignin('base', vars{i}, newData1.(vars{i}));
end
and got the error when run the code
Not enough input arguments.
Error in importfile (line 9)
newData1 = load('-mat', fileToRead1);

Respuesta aceptada

Guillaume
Guillaume el 20 de En. de 2020
Clearly, you've called the function without any input argument. Possibly, you've clicked on the green run button which is not going to work.
You need to give the name of the file to read when you call the function
%code that calls importfile:
importfile('C:\somewhere\somematfile.mat')

Más respuestas (0)

Categorías

Más información sobre Signal Processing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by