1
votes

I have a mat file with a structure that looks like this:

enter image description here

How do I normalize the data and save it as a .dat file (ascii)

2
what do you mean by "normalize"?abcd
1) find the minimum and maximum dataset 2) find Normalized scale minimum and maximum 3) change all numbers in the data set to 4) Normalized valueG Gr
I mean I can manually copy the data from the vec in the mat file and paste into excel then save as csv then convert the csv to .dat but there must be a way to save directly as .dat -ASCIIG Gr

2 Answers

5
votes

I assume that you want to normalize each column.

There are two ways you can normalize:

(1) Set minimum to 0 and maximum to 1

dataset = bsxfun(@minus,dataset,min(dataset));
dataset = bsxfun(@rdivide,dataset,max(dataset));

(2) Set average to zero, standard deviation to 1 (if you don't have the Statistics Toolbox, use mean and std to subtract and divide, respectively, as above).

dataset = zscore(dataset); 

EDIT

Why anyone ever use option 2 to normalize?

When you calculate the difference (dissimilarity) between different data points, you may want to weigh the different dimensions equally. Since dimensions with large variance will dominate the dissimilarity measure, you normalize the variance to one.

0
votes

Your normalization:

dataset = dataset-ones(size(dataset,1),1)*min(dataset) % subtract min
dataset = dataset ./ (ones(size(dataset,1),1)*max(dataset)+eps) % divide by max