Modify and Replace particular columns in an array

1 view (last 30 days)
Hello there, i am a beginner of matlab and
i am having problem that i get array "output" with 14x120 ... (dimension is correct) but this time i want to modify and replace particular columns like
Columns 1 through 6
-0.0728 -0.0621 -0.0918 -0.1055 -0.0864 -0.1205
-0.0699 -0.0234 -0.0995 -0.0503 -0.0090 -0.0826
0.0974 0.0744 0.1191 0.1036 0.0790 0.1247
-0.2722 -0.1985 -0.3369 -0.2245 -0.1605 -0.2993
-0.1489 -0.0950 -0.2100 -0.1813 -0.1191 -0.2390
-0.3367 -0.2839 -0.3959 -0.3471 -0.2900 -0.4072
-0.2041 -0.1758 -0.2553 -0.2776 -0.2299 -0.3204
-0.3105 -0.2385 -0.3688 -0.2540 -0.1944 -0.3225
-0.3176 -0.2660 -0.3690 -0.3122 -0.2608 -0.3664
-0.2951 -0.2536 -0.3478 -0.3377 -0.2848 -0.3863
0.0523 0.0984 0.0184 0.0996 0.1335 0.0595
-0.2245 -0.1611 -0.2775 -0.1682 -0.1157 -0.2338
-0.3455 -0.3061 -0.4095 -0.4114 -0.3561 -0.4656
0.1004 0.1127 0.0803 0.0160 0.0502 0.0062
col- 1 should be as it is and col-3 and col-4 should be log(col-1) and exp(col-1) respectively
similarly col-4 and its corresponding transformation into col-5 and col-6 and so on
Hope My question is clear and please help me with this !! Thank You........

Accepted Answer

Walter Roberson
Walter Roberson on 16 Mar 2014
T = output(:,1:3:end);
new_output = reshape([T; log(T); exp(T)], size(T,1), []);
I think...
  1 Comment
pooja
pooja on 16 Mar 2014
Edited: pooja on 16 Mar 2014
Thank you so much mr walter
it worked as charm :)

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!