Im using prctile() to find the 70th percentile of 1300 elements, but matlab returns error too many input arguments. How can i fix this? Thanks

8 Kommentare

madhan ravi
madhan ravi am 6 Nov. 2018
Show how your calling the function
Elie Elias
Elie Elias am 6 Nov. 2018
prctile(TM{:,7},70)
madhan ravi
madhan ravi am 6 Nov. 2018
size(TM{:,7})
Try the above and paste the result here
Elie Elias
Elie Elias am 6 Nov. 2018
Bearbeitet: Elie Elias am 6 Nov. 2018
it says Too many input arguments too but size (TM) returns 1315
Elie Elias
Elie Elias am 6 Nov. 2018
TM is a 1315x7 cell array
madhan ravi
madhan ravi am 6 Nov. 2018
Try
prctile(cell2mat(TM{:,7}),70)
Elie Elias
Elie Elias am 6 Nov. 2018
still too many arguments
Elie Elias
Elie Elias am 6 Nov. 2018
i tried to do
v=zeros(size(TM,1),1);
v=cell2mat(TM{:,7})
but it still says Too many input arguments

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Stephen23
Stephen23 am 6 Nov. 2018
Bearbeitet: Stephen23 am 6 Nov. 2018

0 Stimmen

The first input to prctile must be numeric (double or single). So your cell array will need to be converted to numeric. You wrote that TM is a cell array, but you have not given us any description of how the data is arranged inside that cell array. This makes it hard to help you, as we have to guess.
If TM is a cell array that contains scalar numeric data in each cell of the seventh column, then try this:
prctile(cell2mat(TM(:,7)),70)

2 Kommentare

Elie Elias
Elie Elias am 6 Nov. 2018
oh it works thanks but why does this work and not prctile(cell2mat(TM{:,7}),70)?
Stephen23
Stephen23 am 6 Nov. 2018
"oh it works thanks but why does this work and not prctile(cell2mat(TM{:,7}),70)?"
Because using curly braces creates a comma-separated list. Read these to know more:

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by