Syntax for make a row vector vs column

3 views (last 30 days)
Effie Miller
Effie Miller on 3 Mar 2019
Answered: Walter Roberson on 3 Mar 2019
Hi there, I've used Matlab for a couple years working primarily off of other people's scripts, but I'm finally trying to really learn the syntax myself to customize/improve these, and running into what I'm sure are very, very basic questions. In my current code I have two vectors of data that I normalize and create two new vectors from (with Norm appended to the front), and then I want to concatenate those two, normalized pieces of data, together.
I realized that it wasn't working within the current function I was using because the normalized vectors I am creating are column vectors, not row vectors. When I manually transpose the vectors prior to running the concatenate section of the program, it works fine. I suspect that because I am reading in the data from a text file that contains two columns of data, Matlab is automatically just making the vectors into columns as well.
My question is: How do I indicate when making a vector that I want it to be a column vs. row vector? OR is it better to just switch the type of vector after making it?
Here is the code I am using to read in the data and then normalize it
[B_X,Spc_XIntD_90sec] = textread ('BCintBCEKM092917_Xband_D2O_90sec_5K_9_639GHz_4096.txt','%f %f');
[Norm_Spc_XIntD_90sec] = Spc_XIntD_90sec/(max(Spc_XIntD_90sec) - min(Spc_XIntD_90sec));
Thanks for any help!

Answers (1)

Walter Roberson
Walter Roberson on 3 Mar 2019
textread and textscan always return columns . There is no way to tell them to return rows.

Products


Release

R2017a

Community Treasure Hunt

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

Start Hunting!