matrix row extraction in

1 Ansicht (letzte 30 Tage)
prabhabathi devi chandrasekaran
Beantwortet: Akira Agata am 19 Mär. 2018
I have to seperate each 16 elements in a 128x1 matrix.In what way i can do this without using loops

Antworten (1)

Akira Agata
Akira Agata am 19 Mär. 2018
Like this?
% Sample 128-by-1 vector
x = (1:128)';
% Solution-1:
nSeg = numel(x)/16;
A = mat2cell(x,repmat(16,1,nSeg),1);
Another possible solution:
% Solution-2:
B = reshape(x,16,[]); % Each column is 16-element segment

Kategorien

Mehr zu Resizing and Reshaping Matrices finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by