normalization data to 0-255
12 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
hakan
am 3 Mai 2023
Kommentiert: Les Beckham
am 19 Mai 2023
Hello eveyone ı have dataset which is this:

ineed to normalize each data to 0 to 255 .
my code :
T = dataset;
K=[,];
N=[,];
[row,col]= size (T);
for i=1:row
for j=1:col -1
K(i,j)=(table2array(T(i,j)));
N(i,j) =uint8(255*mat2gray(K(i,j)));
j=j+1;
end
i=i+1;
end
disp(N);
but when ı try to convert witn in for loop .ı got an output like this .almost all data was converted to 255 .
thx in advance

0 Kommentare
Akzeptierte Antwort
Les Beckham
am 3 Mai 2023
Bearbeitet: Les Beckham
am 3 Mai 2023
format long g
A = [linspace(1, 10, 10); flip(linspace(3, 100, 10)); rand(1,10)].';
T = array2table(A, 'VariableNames', {'ID', 'air_time1', 'disp_index1'});
disp(T)
for iCol=1:width(T)
T(:,iCol) = T(:,iCol) - min(T(:,iCol)); % make the min value zero
columnMax = max(T(:,iCol));
columnMax = table2array(columnMax);
T(:,iCol) = T(:,iCol) .* (255 / columnMax); % make the max value 255
end
disp(T)
3 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!