converting a horizontal matrix to vertical

S
Su-chen-christine-lim · Feb 11, 2021 · 2.1K views
Question
Hello. I am trying to convert a 100*2  matrix to 2*100 matrix. I appreciate if you give me any idea. The reason is I need to find the pick of negative data at second column, and I am using following code:     NEG=[find(E(:,1)<0) E(E(:,1)<0,1)]; so for using following code I need my matrix be 2*100 EE=findpeaks(NEG(:,2));
Expert Answer
Profile picture of John Michell
John Michell PhD Expert
Answered Aug 24, 2026
Use transpose, which can also be written .'
To convert a horizontal matrix to a vertical matrix in MATLAB, you can use the transpose operation. Here’s a simple example:
 
 
>> A = [1,2;3,4;5,6;,7,8]
A =
     1     2
     3     4
     5     6
     7     8
>> A.'
ans =
     1     3     5     7
     2     4     6     8
100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!