Double conversion to use prctile function
Mostrar comentarios más antiguos
Instead of evaluating column by column . I include a for loop so I can use the cell2mat function to convert from double to whatever data type the prctile function uses. However, after the for loop, I get an error message:
"Error using double
Conversion to double from cell is not possible.
Error in prctile (line 55)
x = double(x);
Error in E99 (line 45)
P = prctile(Model_mat(1,:),(99))"
But if I individually convert the column with the cell2mat function- the percentile function works fine.
% This is column by column
Model_mat1 = cell2mat(Model(1,:));
Model_mat2 = cell2mat(Model(2,:));
Model_mat3 = cell2mat(Model(3,:));
Model_mat4 = cell2mat(Model(4,:));
Model_mat5 = cell2mat(Model(5,:));
Model_mat6 = cell2mat(Model(6,:));
Model_mat7 = cell2mat(Model(7,:));
Model_mat8 = cell2mat(Model(8,:));
Model_mat9 = cell2mat(Model(9,:));
Model_mat10 = cell2mat(Model(10,:));
% This is the for loop
for i = 1:length(Model)
%Model_mat{i,:} = cell2mat(Model(i,:));
%Model_mat{i,:} = int64(Model(i,:));
Model_mat{i} = cell2mat(Model(i,:));
end
% This iis the syntax for the percentile
P = prctile(Model_mat(1,:),(99))
Any help would be appreciated.
1 comentario
Rik
el 15 de Sept. de 2022
What exactly is your question? You seem to have a cell array of some sort, but you want the percentile function to do that conversion for you?
It would all be easier to understand if you attach your data to the question.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Descriptive Statistics en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!