add columns (as operations of original colms) at specific intervals in array w'out overwriting original colms
Info
This question is closed. Reopen it to edit or answer.
Show older comments
Hello,
i am a new student in matlab , i need a help
i have a array named " train_data " of size m x n (having m attributes and n examples)
i want to add "two" corresponding columns to each n columns of train_data
just for example:
0.0937 -0.0227 -0.0904 -0.0852 -0.0887
0.1397 -0.0505 0.0211 0.0095 -0.0267
0.0627 -0.0356 0.2087 -0.0134 0.0020
5 columns here , and i want 15 columns
no change in 1st col , multiply it with 2 ,multiply it with 4 and add them in next two columns respectively
do same for all the columns
how this can be done with m x n array ??
Answers (1)
Chandrasekhar
on 21 Mar 2014
A = [0.0937 -0.0227 -0.0904 -0.0852 -0.0887
0.1397 -0.0505 0.0211 0.0095 -0.0267
0.0627 -0.0356 0.2087 -0.0134 0.0020]
then
A = [A(:,1) A(:,1)*2 A(:,1)*4 A(:,2) A(:,2)*2 A(:,2)*4 ....... A(:,5) A(:,5)*2 A(:,5)*4]
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!