Error using reshape To RESHAPE the number of elements must not change.
Show older comments
This is the code:
d = input('Enter the number of rows(d) : ');
k = input('Enter the number of columns(k) : ');
for i=1:d
for j=1:k
T(i,j)= input('Enter the elements - ');
end
end
T = reshape(T,d,k);
I've put 30 as row number and 3 as column number.After entering the elements it shows this error "Error using reshape To RESHAPE the number of elements must not change." Help me to solve this
3 Comments
jonas
on 31 May 2018
Nope, I'm not getting any error.
Kaninika Pant
on 1 Jun 2018
You created T with d number of rows and k number of columns. reshape(T,d,k) will not modify anything. Why are you doing this?
Accepted Answer
More Answers (1)
Fangjun Jiang
on 31 May 2018
0 votes
There is no error in your code. It should have no error if your put in all the d*k elements.
There is no need to run reshape(). Your matrix T is already in dxk.
Categories
Find more on Matrices and Arrays 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!