Ask an expert. Trust the answer.

Your academic and career questions answered by verified experts

Change row vector to column vector

Date: 2022-07-27 10:52:51

How can I change this into a column, at the moment all 750 entries are on one row? 

 

p = normal(1:750)-1;

I have tried: 

 

columns = 1;
p = normal(1:750)-1;
p = p(1:columns);

I have also tried: 

 

rows = 1000;
p = normal(1:750)-1;
p = p(1:rows)';

Answers: 

It is common practice in MATLAB to use the colon operator : for converting anything into a column vector. Without knowing or caring if normal is a row vector or a column vector, you can force p to be a column vector, like so:  

 

p = p(:);

After this, p is guaranteed to be a column vector.


Why Matlabhelpers ?

Our Matlab assignment helpers for online MATLAB assignment help service take utmost care of your assignments by keeping the codes simple yet of high-quality. We offer the most reliable MATLAB solutions to students pursuing their Computer Science course from the Monash University, the University of Sydney, the University of New South Wales, the University of Melbourne; to name a few. Approach us today for best Matlab solutions online!

whatsApp order on matlabhelpers.com

telegram order on matlabsolutions.com