Arguments of Reshape function with example

6 views (last 30 days)
Hi everyone. I am completely new to matlab and struggling with the syntax.
Suppose,
A = [1 2; 3 4; 5 6]
reshape(A, [1,6])
reshape(A, [1 6])
Both the reshape gives similar kind of result. I am confused with the syntax. Please explain me the syntax and working of reshape.
Suppose, if I put
reshape (A, [1 2]) then I will start getting errors.
Suppose I have a colored image of 64x64.

Accepted Answer

KSSV
KSSV on 18 Jan 2022
A = [1 2; 3 4; 5 6] ;
% this is a 3*2 matrix
reshape(A, [1,6])
reshape(A, [1 6])
% Both the above commands are same. whether you put , in [1 6] or not mean the same.
reshape (A, [1 2]) % this will definetly throw error, becuase you can reshape 3*2 = 6 elements into 1*2 = 2 elements.
You have 64*64 colored image, what exactly you want to do with it?
  7 Comments
Manu Chaudhary
Manu Chaudhary on 18 Jan 2022
Thank you Stephen and KSSV for sharing such great links and answering my all questions. I am highly thankful to you for your generous help and support.

Sign in to comment.

More Answers (0)

Categories

Find more on Particle & Nuclear Physics in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!