Matrix problem in Matlab
Matrix problem in Matlab
(OP)
im new to matlab and i hope you pros can solve my problem.
i have 2 different matrix. Matrix A is 4500X8 and matrix B is 4000X8.
is there anyway i can change the size of the matrix to 4230X1???
thanx to all of you in advance :)
i have 2 different matrix. Matrix A is 4500X8 and matrix B is 4000X8.
is there anyway i can change the size of the matrix to 4230X1???
thanx to all of you in advance :)





RE: Matrix problem in Matlab
i.e.
% Make a simple matrix
a=rand(3,5)
% Copy matrix and then display and remove the second row
b = a;
b(2,:)
b(2,:) = []
% Copy matrix and then remove the display and third and fourth columns
c = a;
c(:,3:4)
c(:,3:4) = []
A(:,2:end)=[]
RE: Matrix problem in Matlab
is there anyway i wont lose my data and at the same time reshape it??
thanx for ur reply man...
RE: Matrix problem in Matlab
RE: Matrix problem in Matlab
You can create a matrix of any size using 'ones()' and 'zeros()' depending on what you would like to do.
For example.
vec = zeros( r, c );
This creates a vector 'vec' with rows 'r' and columns 'c' filled with the number '0.' This would be used in a situation where you would like to ADD the new data to the matrix.
vec2 = ones( r, c);
This creates a vector 'vec2' with rows 'r' and columns 'c' filled with the number '1.' This would be used if you wanted to multiply the data to the new matrix.
SECOND THOUGHT...
Try this....
vec = a( row, col )
with row you can obviously define what you would like to take out. For example, row = 1:4230...etc etc
if 'A' is a 4500 x 8 vector then....
vec = A( 1:4230, 3 )
would store all of the rows from 1 to 4230 in the 3rd column in a vector of 4230 x 1