Cannot run with provided input arguments

7 Ansichten (letzte 30 Tage)
Lakshmi
Lakshmi am 4 Apr. 2024
Kommentiert: Voss am 4 Apr. 2024
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);

Antworten (2)

Jon
Jon am 4 Apr. 2024
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 Kommentar
Voss
Voss am 4 Apr. 2024
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.

Melden Sie sich an, um zu kommentieren.


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

Kategorien

Mehr zu Data Import and Analysis finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by