Effacer les filtres
Effacer les filtres

Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

add columns (as operations of original colms) at specific intervals in array w'out overwriting original colms

2 vues (au cours des 30 derniers jours)
prerna kaul
prerna kaul le 21 Mar 2014
Clôturé : MATLAB Answer Bot le 20 Août 2021
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 ??

Réponses (1)

Chandrasekhar
Chandrasekhar le 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]

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!

Translated by