File tree Expand file tree Collapse file tree 5 files changed +10
-2
lines changed Expand file tree Collapse file tree 5 files changed +10
-2
lines changed Original file line number Diff line number Diff line change 107107
108108% Load an image of a bird
109109A = double(imread(' bird_small.png' ));
110+
111+ % If imread does not work for you, you can try instead
112+ % load ('bird_small.mat');
113+
110114A = A / 255 ; % Divide by 255 so that all values are in the range 0 - 1
111115
112116% Size of the image
Original file line number Diff line number Diff line change 190190% Re-load the image from the previous exercise and run K-Means on it
191191% For this to work, you need to complete the K-Means assignment first
192192A = double(imread(' bird_small.png' ));
193+
194+ % If imread does not work for you, you can try instead
195+ % load ('bird_small.mat');
196+
193197A = A / 255 ;
194198img_size = size(A );
195199X = reshape(A , img_size(1 ) * img_size(2 ), 3 );
Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ function submit(partId)
9393 X = reshape(sin(1 : 165 ), 15 , 11 );
9494 Z = reshape(cos(1 : 121 ), 11 , 11 );
9595 C = Z(1 : 5 , : );
96- idx = 1 + mod(1 : 15 , 3 );
96+ idx = ( 1 + mod(1 : 15 , 3 )) ' ;
9797 if partId == 1
9898 idx = findClosestCentroids(X , C );
9999 out = sprintf(' %0.5f ' , idx(: ));
Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ function submitWeb(partId)
8585 X = reshape(sin(1 : 165 ), 15 , 11 );
8686 Z = reshape(cos(1 : 121 ), 11 , 11 );
8787 C = Z(1 : 5 , : );
88- idx = 1 + mod(1 : 15 , 3 );
88+ idx = ( 1 + mod(1 : 15 , 3 )) ' ;
8989 if partId == 1
9090 idx = findClosestCentroids(X , C );
9191 out = sprintf(' %0.5f ' , idx(: ));
You can’t perform that action at this time.
0 commit comments