# How to create a Matrix

4 views (last 30 days)
Omar Eissa on 9 May 2021
Commented: Huma Hafeez on 24 May 2021
What should i write in the code to create this matrix
##### 1 CommentShow -1 older commentsHide -1 older comments
Huma Hafeez on 24 May 2021
you can write this in MATLAB like:
A=[22 18 14; 21 17 13; 20 16 12; 19 15 11]
I would suggest you to take MATLAB Fundamentals course, its free

Sign in to comment.

### Answers (6)

David Fletcher on 9 May 2021
A=[22 18 14; 21 17 13; 20 16 12; 19 15 11]
I would recommend you have a look at the Matlab Onramp course. It will give you a good grounding in the basics of Matlab
##### 3 CommentsShow 1 older commentHide 1 older comment
David Fletcher on 9 May 2021
Ahh ok - didn't look at the picture. Somebody else has answered anyway.
Omar Eissa on 9 May 2021
thank you

Sign in to comment.

Mahaveer Singh on 19 May 2021
A=[22:-1:11];
M= reshape(A,4,3)
##### 0 CommentsShow -2 older commentsHide -2 older comments

Sign in to comment.

Andrei Bobrov on 9 May 2021
Edited: Andrei Bobrov on 9 May 2021
A = reshape(flip(11:22),4,[])
A = reshape(22:-1:11,4,[])
##### 4 CommentsShow 2 older commentsHide 2 older comments
Omar Eissa on 9 May 2021
and what should i do now?
Andrei Bobrov on 9 May 2021
Edited: Andrei Bobrov on 9 May 2021
v = 22:-1:11;
A = reshape(v,4,[]);
or
v = 22:-1:10;
n = numel(v);
A = reshape(v(1:n - mod(n,4)),4,[])

Sign in to comment.

fyp matlab on 14 May 2021
Just write this to create this Matrix
A=[22 18 14; 21 17 13; 20 16 12; 19 15 11]
##### 0 CommentsShow -2 older commentsHide -2 older comments

Sign in to comment.

Kartikay Sapra on 19 May 2021
You can use:
A = reshape(22:-1:11, 4, 3)
##### 0 CommentsShow -2 older commentsHide -2 older comments

Sign in to comment.

RAHUL MAURYA on 24 May 2021
a=[22 28 14;21 17 23;20 16 12;19 15 11]
##### 0 CommentsShow -2 older commentsHide -2 older comments

Sign in to comment.

### Categories

Find more on Matrix Indexing in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!