I am doing a feature extraction using glcm method. The glcm output are in 'struct' type, while I need the output in double type.
So, I've tried to convert it using several code showed below.
To get Fetest1 code:
srcFile = dir('D: datatest\*.png');
fetest1 = []; %or fetrain1
for b = 1:length(srcFile)
file_name = strcat('D:datatest\',srcFile(b).name);
B = imread(file_name);
% [fiturtest] = feature_extractor (B);
[g] = glcm (B);
[g] = struct2cell (g);
[fiturtest] = cell2mat (g); %fiturtrain
% [c] = CobaDCT (A);
% [fitur] = cobazigzag(c);
% arr(:,a) = fitur;
fetest1 = [fetest1 fiturtest]; %fiturtrain
% vectorname = strcat(file_name,'_array.mat');
end
save ('fetest1.mat','fetest1'); %fetrain1
To get Fetrain1 code:
srcFiles = dir('D:datatrain\*.png');
fetrain1 = [];
for a = 1:length(srcFiles)
file_name = strcat('D:datatrain\',srcFiles(a).name);
A = imread(file_name);
[fiturtrain] = feature_extractor (A);
% [c] = CobaDCT (A);
% [fitur] = cobazigzag(c);
% fiturtrain (:,a) = fiturtrain ;
fetrain1 = [fetrain1 fiturtrain];
% vectorname = strcat(file_name,'_array.mat');
end
save ('fetrain1.mat','fetrain1');
The output of the whole process is fetrain1 and fetest1 variables. I run the same code to get fetest1 and fetrain1, but fetest1 is in 'double' type, while fetrain is in 'complex double' type.
and
I need to convert fetrain1 from 'complex double' type into 'double' type, so I can use the variable for the next step. Training step using Neural Network method.
Any suggestion would be very appreciated.