MATLAB Answers

how to convert a numeric matrix to cell array without changing its property?

1 view (last 30 days)
DEEPAK PHCSFI17041149
DEEPAK PHCSFI17041149 on 26 Dec 2017
Edited: Jan on 26 Dec 2017
i have a training matrix A of dimension 384x4160, inorder to create labels and supply it as a input to the svmtrain function, i have converted the matrix to a cell array using the following command,
train_cell={train(1:64,:),train(65:128,:),train(129:192,:),train(193:256,:),train(257:320,:),train(321:384,:)};
it has given me a 1x6 cellarray say (B) of the following dimension,
64x4160 double 64x4160 double 64x4160 double 64x4160 double 64x4160 double 64x4160 double
As per the svm documentation the train matrix must be a numeric array, but after the conversion of matrix to cell array using the above command, the cellarray becomes non-numeric. i.e when i give
isnumeric(train_cell)
the answer is,
ans =
logical
0
Kindly, suggest me how to convert the matrix to cellarray by holding its numeric property.

Answers (1)

Jan
Jan on 26 Dec 2017
Edited: Jan on 26 Dec 2017
You can't. A cell array is by definition a cell array, while only numerical arrays are numerical arrays.
As per the svm documentation the train matrix must be a numeric array, ...
Exactly. Then a conversion to a cell is not a valid option.
What is the actual problem you want to solve? What does this exactly mean: "in order to create labels and supply it as a input"?

Community Treasure Hunt

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

Start Hunting!

Translated by