I have script in MATLAB that uses the subplot function. Now I know that it takes 3 arguments minimum to work as I have seen in the MATLAB docs. However, it give an error saying too many input arguments. This is the code
%% ================= Part 5: Image Compression ======================
% Find closest cluster members
idx = findClosestCentroids(X, centroids);
% Essentially, now we have represented the image X as in terms of the
% indices in idx.
% We can now recover the image from the indices (idx) by mapping each pixel
% (specified by its index in idx) to the centroid value
X_recovered = centroids(idx,:);
% Reshape the recovered image into proper dimensions
X_recovered = reshape(X_recovered, img_size(1), img_size(2), 3);
% Display the original image
subplot(1, 2, 1);
imagesc(A);
title('Original');
% Display compressed image side by side
subplot(1, 2, 2);
imagesc(X_recovered)
title(sprintf('Compressed, with %d colors.', K));
At the '%Display the original image section', it is giving an error saying
Error using subplot
Too many input arguments.
Error in ex7 (line 162)
subplot(1,2,1);
I cannot understand why MATLAB will be giving such an error. Please explain.
subplot?