concatination rows of matrix for making a new matrix
2 ビュー (過去 30 日間)
古いコメントを表示
Hi.i have a matrix(1000 * 64) that is filled with 1 and 0 .i wanna to concatinate bits of rows to make a matrix 1000 * 1 .i dont know how to do it:(
0 件のコメント
採用された回答
Ameer Hamza
2020 年 12 月 2 日
If you want to pack the bits to create a vector of uint64 datatype then try this
M = randi([0 1], 1000, 64); % random vector
M_new = uint64(M);
x = uint64(2).^uint64(63:-1:0);
M_new = sum(M_new.*x,2,'native');
その他の回答 (1 件)
KSSV
2020 年 12 月 2 日
% Data for demo
A = [0 0 1 1 0 0 0
0 0 1 1 0 0 1
0 0 1 0 0 0 0];
iwant = char(A+'0');
2 件のコメント
参考
カテゴリ
Help Center および File Exchange で Numeric Types についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!