Manipulation of cell to convert into a matrix
이전 댓글 표시
Hello everyone,
Assume that A = 2x2 cell, with :
A = {[5] [1,1,0] ;[4] [1,1]}
I'm trying to convert it into a matrix array. Is there a way to transform A to this matrix A_convert :
A_convert = [5 110 ; 4 10]
Because the cells {1,2} and {2,2} are supposed to be binary code.
Or Is it possible to have some matrix with mixed classes ? For example, we can imagine have :
[5 '110' ; 4 '10']
I already try functions cell2 'smth' but it dosen't work the way I want to do my conversion, it not the answer i'm looking for.
To illustrate my point, for example, I cannot run the script below because of a dimensions of arry issue :
% A_try = cell2mat(A)
Because, with this script we're trying to do that : [5 1 1 0 ; 4 1 0] and of course the dimensions don't match.
Thanks in advance for your help !
댓글 수: 2
Jan
2022년 10월 26일
Converting [1,1,0] to 110 does not look like a binary code. This is a decimal conversion.
[5 '110' ; 4 '10'] is not possible in Matlab. To mix variables of different type in one array, cell arrays are the correct method. So what about using the original cell? What do you consider as benefit of [5 '110' ; 4 '10']?
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Data Type Conversion에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!