Double conversion to use prctile function
이전 댓글 표시
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
Rik
2022년 9월 15일
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.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Descriptive Statistics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!