Cannot run with provided input arguments

Hello everyone,
I am facing error while creating GUI in look_up function "Not enough input arguments".
function updateGraph(app, selectedLabel)
gm_id = 0:0.1:50;
id_w = look_up(app.nch, 'ID_W', 'GM_ID', gm_id, 'L', selectedLabel);
% Plot ID_W against GM_ID on the UIAxes component
semilogx(app.UIAxes, (id_w)*10^6, gm_id, 'DisplayName', ['L = ', num2str(selectedLabel)]);
title(app.UIAxes, selectedLabel);
xlabel(app.UIAxes, 'g_m/I_D [S/A]');
ylabel(app.UIAxes, 'I_D/W [A/m]');
end
error:Not enough input arguments.
Error in app1/updateGraph (line 42)
id_w = look_up(app.nch, 'ID_W', 'GM_ID', gm_id, 'L', selectedLabel);

Réponses (2)

Jon
Jon le 4 Avr 2024

0 votes

The error is coming from your call to a function named look_up. The error is telling you that you are not supplying this function with enough input arguments. You supply 6, apparently it wants more. Since look_up, is not a standard MATLAB function, it must either be something you wrote, or someone else wrote that you are using. As you don't supply the code for this function I can't give you further details, but you should check the code for your function named look_up, and when you call it be sure to match the list of arguments it is expecting with the ones your are supplying

1 commentaire

I don't think the error is from look_up being passed too few arguments; you can always call a function with fewer arguments than are defined in its input argument list. Just calling the function like that doesn't cause an error; an error occurs inside the called function when an input is referred to which has not been passed in.
Example:
fun(1) % error doesn't happen here
% (it's ok to pass fewer arguments to fun
% than it expects - it's up to fun to handle that)
function fun(a,b)
disp([a,b]) % error happens here because b is undefined (fun is not
% handling missing arguments properly in this case)
end
In OP's case it looks to me like the error is in updateGraph, due to selectedLabel not having been passed in.

Connectez-vous pour commenter.

Voss
Voss le 4 Avr 2024

0 votes

Not enough inputs are given to updateGraph; it expects selectedLabel to be given, but it's not.
How are you calling updateGraph?

Catégories

En savoir plus sur Entering Commands dans Centre d'aide et File Exchange

Tags

Question posée :

le 4 Avr 2024

Commenté :

le 4 Avr 2024

Community Treasure Hunt

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

Start Hunting!

Translated by