MATLAB Answers

How to Convert 3d matrix to row matrix???

1 view (last 30 days)
Mehul Jain
Mehul Jain on 8 Apr 2020
Commented: Mehul Jain on 9 Apr 2020
I have a 3d matrix in the workspace variable named WT.dec{1,1}, I need it to be converted to single dimention row matrix. How can do this???

  0 Comments

Sign in to comment.

Accepted Answer

Aoi Midori
Aoi Midori on 8 Apr 2020
A = rand(10,10,10);
B = reshape(A,[1,1000]);

  4 Comments

Show 1 older comment
Mehul Jain
Mehul Jain on 8 Apr 2020
So how can read this to csv file???
darova
darova on 8 Apr 2020
Can't you write it as column? Or matrix?

Sign in to comment.

More Answers (1)

Vladimir Sovkov
Vladimir Sovkov on 8 Apr 2020
a=rand(2,2,2) % a sample 3D matrix a
b=a(:)' % is turned to the 1D row matrix b

  1 Comment

Mehul Jain
Mehul Jain on 8 Apr 2020
I tried this 1d matrix writing to .csv file, but i am getting error.
a=rand(17,19,17)
b=a(:)'
xlswrite('RV.csv',B);
Error using xlswrite (line 219)
The specified data range is invalid or too large to write to the specified file format. Try writing to an XLSX file and use Excel A1 notation for the range argument, for example, ‘A1:D4’.

Sign in to comment.

Tags