How can I solve matrix selection extraction

1 vue (au cours des 30 derniers jours)
인범 황
인범 황 le 28 Juin 2022
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
  1 commentaire
KSSV
KSSV le 28 Juin 2022
Read about indexing in MATLAB.

Connectez-vous pour commenter.

Réponses (3)

Chunru
Chunru le 28 Juin 2022
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

AMIT POTE
AMIT POTE le 28 Juin 2022
You can go through the following documentation to understand indexing in MATLAB

Neeraj Mirji
Neeraj Mirji le 28 Juin 2022
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.

Catégories

En savoir plus sur Mathematics dans Help Center et File Exchange

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by