Modify and Replace particular columns in an array

조회 수: 22 (최근 30일)
pooja
pooja 2014년 3월 16일
편집: pooja 2014년 3월 16일
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........

채택된 답변

Walter Roberson
Walter Roberson 2014년 3월 16일
T = output(:,1:3:end);
new_output = reshape([T; log(T); exp(T)], size(T,1), []);
I think...
  댓글 수: 1
pooja
pooja 2014년 3월 16일
편집: pooja 2014년 3월 16일
Thank you so much mr walter
it worked as charm :)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by