MATLAB子图函数sys输入参数太多

时间:2017-05-28 06:14:36

标签: matlab

我在MATLAB中有使用子图功能的脚本。现在我知道最少需要3个参数才能工作,就像我在MATLAB文档中看到的那样。但是,如果输入参数太多,则会出错。这是代码

%% ================= 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 个答案:

答案 0 :(得分:1)

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

which subplot -all
相关问题