Filter löschen
Filter löschen

Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

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

2 Ansichten (letzte 30 Tage)
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 ??

Antworten (1)

Chandrasekhar
Chandrasekhar am 21 Mär. 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]

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by