필터 지우기
필터 지우기

I want to normalize just one column, how do i do that ?

조회 수: 2 (최근 30일)
Diogo Costa
Diogo Costa 2021년 5월 20일
답변: Steven Lord 2021년 5월 20일
  댓글 수: 1
Diogo Costa
Diogo Costa 2021년 5월 20일
The colum is the 12 that i want to normalize, i can't find a way to do a code that normalize one or specific columns without changing the others

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

채택된 답변

Steven Lord
Steven Lord 2021년 5월 20일
format shortg % Changing the display format to make the normalized matrix look nicer
M = magic(6)
M = 6×6
35 1 6 26 19 24 3 32 7 21 23 25 31 9 2 22 27 20 8 28 33 17 10 15 30 5 34 12 14 16 4 36 29 13 18 11
M(:, 4) = normalize(M(:, 4)) % Normalized with 'zscore'
M = 6×6
35 1 6 1.3716 19 24 3 32 7 0.4572 23 25 31 9 2 0.64008 27 20 8 28 33 -0.27432 10 15 30 5 34 -1.1887 14 16 4 36 29 -1.0058 18 11
M([1 3], :) = normalize(M([1 3], :), 2, 'center') % normalize so rows 1 and 3 have mean 0
M = 6×6
20.605 -13.395 -8.3953 -13.024 4.6047 9.6047 3 32 7 0.4572 23 25 16.06 -5.94 -12.94 -14.3 12.06 5.06 8 28 33 -0.27432 10 15 30 5 34 -1.1887 14 16 4 36 29 -1.0058 18 11
[mean(M(1, :)), mean(M(3, :))] % check -- should be close to 0
ans = 1×2
8.8818e-16 1.1842e-15

추가 답변 (1개)

Jonas
Jonas 2021년 5월 20일
편집: Jonas 2021년 5월 20일
use
data(:,12)=data(:,12)/max(abs(data(:,12)));
if your data in column 12 is not negative, then you can leave out the abs() function

카테고리

Help CenterFile Exchange에서 Hypothesis Tests에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by