1,215 views (last 30 days)

Show older comments

Akash h.r
on 16 Aug 2016

m=input('row')

n=input('column')

for i=1:m

for j=1:n

a(i,j)=input('elements-')

end

end

a=reshape(a,m,n)

Anuj
on 21 Feb 2014

One simple way for this can be, Suppose you have square matrix of order n. So you have n^2 elements. You can enter all the elements one by one and change it into square matrix like this-

n=input('order of your square matrix is? ')

for i=1:n^2;

a(i)=input('elements-');

end

a=reshape(a,n,n)'

Regards

Akash h.r
on 16 Aug 2016

m=input('row')

n=input('column')

for i=1:m

for j=1:n

a(i,j)=input('elements-')

end

end

a=reshape(a,m,n)

Bhupendra Raj Acharya
on 6 Feb 2020

m=input('row')

n=input('column')

for i=1:m

for j=1:n

a(i,j)=input('elements-')

end

end

a=reshape(a,m,n)

Walter Roberson
on 5 Dec 2020

The above code is valid in the command window -- though I would recommend putting in extra spaces,

m=input('row ')

n=input('column ')

for i=1:m

for j=1:n

a(i,j)=input('elements- ')

end

end

a=reshape(a,m,n)

Amjad Alotaibi
on 19 Feb 2020

m=input('row')

n=input('column')

for i=1:m

for j=1:n

a(i,j)=input('elements-')

end

end

a=reshape(a,m,n)

Walter Roberson
on 18 Jan 2021

Lam Nguyen Van
on 24 Mar 2020

help me. I want to input symbols matrix. ex: [a b c; f a h]

Mehedi Hasan
on 9 Sep 2020

How to take matrix from user. Calculate the mean, variance, covariance and standard

deviation for that matrix. Draw the histogram graph.

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

Start Hunting!