create a column vector of am data set in matlab

To create a column vector of a data set in Matlab, you can use the command transpose or ' operator to convert a row vector into a column vector. Here is an example code to create a column vector 'colVec' from a row vector 'rowVec':

main.m
rowVec = [1, 2, 3, 4, 5]; % create a row vector 
colVec = rowVec.'; % convert it into a column vector using transpose operation 
129 chars
3 lines

Another way to create a column vector is to directly define it as a column vector using square brackets, as shown in the following example:

main.m
colVec = [1; 2; 3; 4; 5]; % directly define a column vector
60 chars
2 lines

In both methods, the resulting variable 'colVec' will be a column vector of the data set.

Note: The transpose operation can be replaced with the shorter ' operator.

related categories

gistlibby LogSnag