필터 지우기
필터 지우기

data extract from array or vector

조회 수: 3 (최근 30일)
Habtamu Tsegaye
Habtamu Tsegaye 2023년 1월 28일
댓글: Voss 2023년 1월 28일
how to extract rows from single column array using loop? example I have 96X1, I need extract like (1,13,25...end), (2,14,26,....end), (3,15,27,....end)

답변 (1개)

Voss
Voss 2023년 1월 28일
data = rand(96,1); % 96-by-1 column vector
for ii = 1:12
subset = data(ii:12:end);
% do something with subset
end
Or you can reshape the column vector into a matrix:
all_subsets = reshape(data,12,[]).';
Then each column of all_subsets is one of the subsets you got in the loop.
  댓글 수: 2
Habtamu Tsegaye
Habtamu Tsegaye 2023년 1월 28일
thank you!
Voss
Voss 2023년 1월 28일
You're welcome! Any questions, let me know; otherwise, please Accept this Answer. Thanks!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by