How to Generate Images from Mat File in Matlab



load('WM811K.mat');

%% Select training and test data
trainTestLabel={data.trainTestLabel};
trainIdx=find(strcmp(trainTestLabel,'Training'));

 %% Show each failure type
type={data.failureType};
disp(type);
trainFailureType=type(trainIdx);
%testFailureType=failureType(testIdx);
%waferFailType=unique(trainFailureType);

%% Plot a wafer map
idx=find(strcmp(trainFailureType,type{6}));
disp(type{6});
disp(length(idx));
for i=1:length(idx)
    exampleIdx=trainIdx(idx(i));
    waferMap=data(exampleIdx).waferMap;
    %imagesc(waferMap);
    myMap=      [ 1 1 1; ... % empty elements use white color
                 0 1 1 ; ... % good dice use cyan color
                 1 0 1 ];    % defective dice use magenta color
    %colormap(myMap);
    filename = sprintf('Near Full_%d.jpg', i) ;
    imwrite(waferMap,myMap,filename,'bmp');
 
end



Share on Google Plus

About Ashadullah Shawon

I am Ashadullah Shawon. I am a Software Engineer. I studied Computer Science and Engineering (CSE) at RUET. I Like To Share Knowledge.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment