2017-05-28 45 views
0

我有使用子图功能的MATLAB脚本。现在我知道它至少需要3个参数才能正常工作,正如我在MATLAB文档中看到的那样。但是,它提供了一个错误,说明输入参数太多。这是代码MATLAB的子图函数sys太多的输入参数

%% ================= 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)); 

在“%显示原始图像部分”,它给一个错误,说

Error using subplot 
Too many input arguments. 
Error in ex7 (line 162) 
subplot(1,2,1); 

我不明白为什么MATLAB将给予这样的错误。请解释。

+1

是否有叫'subplot'本地目录中的文件? – TroyHaskin

+0

告诉哪个子图的结果 –

回答

1

它看起来像你有另一个同名的功能。 搜索子功能在同一个文件或搜索全局文件:

which subplot -all