How can I solve matrix selection extraction

Hello, I am a college student studying MATLAB.
I want to select columns 1-101, columns 103-203, 205-305, and columns 307-407 among the attached 309×816 matrices and make them into one matrix.
How can i solve it. Please let me know.
thank you

답변 (3개)

Chunru
Chunru 2022년 6월 28일
load C.mat
% select columns 1-101, columns 103-203, 205-305, and columns 307-407
% and make them into one matrix.
WhatYouWant = C(:, [1:101 103:203 205:305 307:407]);
% The : means all rows; [....] means the selected columns
whos
Name Size Bytes Class Attributes C 309x816 2017152 double WhatYouWant 309x404 998688 double ans 1x30 60 char cmdout 1x33 66 char
Neeraj Mirji
Neeraj Mirji 2022년 6월 28일

0 개 추천

The following code extracts the mentioned columns into newMatrix.
newMatrix = C(: , [1:101 103:203 205:305 307:407]);
Check out Matrix Indexing documentation of better understanding.

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품

릴리스

R2022a

질문:

2022년 6월 28일

답변:

2022년 6월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by