Hi, I have data with dimension 1x25, where
x = rand(1,25);
D = size(x,2);
I'm trying using this code, but the result is NaN. Please help me, to fix my code. Thanks
for col = 1: D
x(:,col)=double(x(:,col)-mean(x(:,col)));
end
for col = 1: D
x(:,col)=double(x(:,col)/std(x(:,col)));
end

 채택된 답변

Stephan
Stephan 2018년 12월 16일

1 개 추천

x = rand(1,25);
x = (x-mean(x))/std(x)

댓글 수: 3

Oman Wisni
Oman Wisni 2018년 12월 16일
thanks for the answer sir, but when I use in matrik with size 220x25 dimension, I get error like this :
x = rand(220,25);
x = (x-mean(x))/std(x)
Error using -
Matrix dimensions must agree.
Stephan
Stephan 2018년 12월 16일
편집: Stephan 2018년 12월 16일
Which Matlab release do you use? In 2018b the result is a 220x1 vector.
Oman Wisni
Oman Wisni 2018년 12월 16일
I used matlab R2015a

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

태그

질문:

2018년 12월 16일

댓글:

2018년 12월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by