ginput Error (Too many input arguments).

Hello,
I was trying to acquire some data from a plot and have used this method sucessfully in the past. Now i can't seem to use it. Attaching my code with comments from command window. When the code gets to run ginput it says too many input arguments and does not throw cursors on the screen. Any help would be highly appreciated.
>> clearvars;
[filename,pathname] = uigetfile({'*.xlsx';'*.csv';'*.xls'});
fullfilename = fullfile(pathname,filename);
A = xlsread(fullfilename);
Torque = movmean(A(22:end,3),35);
Angle = movmean(A(22:end,2),35);
plot(Torque);
[a] = ginput(2);
startingIndex = a(1);
endingIndex = a(2);
x = 1 : length(Torque);
zone = find(x >= startingIndex & x <= endingIndex);
Torque1 = Torque(zone);
Angle1 = Angle(zone);
Error using ginput
Too many input arguments.

7 Commenti

What does
which ginput
show?
I am just using one Ginput. When i have one of the Parameters ploted agnist a random x-axis. My Torque is plotted on the Y-Axis. In the command window i get an error message as "Too many input Arguments". Do not get an option of Cursors on the Screen.
What is the output of the command
which -all ginput
Sai Gudlur
Sai Gudlur il 5 Feb 2020
Modificato: Sai Gudlur il 5 Feb 2020
Have attached a screenshot of the error i see. with the plot and no cursors.
Now i understand the question better you mean startingIndex or EndingIndex am i right? If that is what you asking it doesn't get there. Either of the index's start only after i select my points using cursors. My cursors aren't even popping up on the screen. Please see the attached screenshot on my previous comment and you would see underwork space. Had it let me select on the curve i would have had starting and ending index in workspace.
We understand the error message that you are getting. Now we need you to help us diagnose the problem by executing the command we posted and telling us the results.
Sorry about that, i wasn't aware of this method. Please see the message i recieve when i keyin the commands suggested by you and Adam.
which -all ginput
C:\Users\agudlur\Documents\MATLAB\ginput.mlapp % ginput constructor
C:\Program Files\MATLAB\R2018b\toolbox\matlab\uitools\ginput.m % Shadowed

Accedi per commentare.

 Risposta accettata

You need to delete or rename
C:\Users\agudlur\Documents\MATLAB\ginput.mlapp

3 Commenti

Thanks a lot Adam and Walter this worked. But may i know what exactly was the issue? I mean i had made an app which was using ginput but this code had nothing to do with that. Why was it linking to that? Thanks for your time and solution.
Apps are invoked by the part of the name before the file extension, so ginput.mlapp would be invoked as ginput . Apps are permitted to accept parameters if they want: they are invoked the same way that functions are invoked.
So you had two things named ginput both of which could be invoked in function form.
The question then is how MATLAB would choose between them when it encountered an invocation of ginput. MATLAB has a set of rules about which name has priority. The relevant rule in this case is that your Documents\MATLAB folder is earlier on your search path than the normal location it would find ginput, so it took yours.
As a general guideline: in MATLAB if you provide a function with the same name as an existing MATLAB function then your function will often override the MATLAB function. Not always.
Thanks a lot for the information. Will Keep that in mind and not name apps that such no internal functions/keywords as part of their name. Thanks again.

Accedi per commentare.

Più risposte (0)

Categorie

Prodotti

Release

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by