MATLAB: How to normalize data

datanormalize

Hi, I have data with dimension 1×25, 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

Best Answer

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