フィルターのクリア

Have I done some mistake in the following line

1 回表示 (過去 30 日間)
Poonam
Poonam 2013 年 9 月 22 日
function y = meanShiftseg(x,hs,hr,th,plotOn)
%%Argument Check
if nargin < 3
error('please type help for function syntax');
elseif nargin == 3
th = .25; plotOn = 1;
elseif nargin == 4
if th<0 || th >255
error('threshold should be in [0,255]');
else
plotOn = 1;
end
elseif nargin == 5
if sum(ismember(plotOn,[0,1])) == 0
error('plotOn option has to be 0 or 1');
end
elseif nargin>5
error('too many input arguments');
end
%%initialization
%x = double(x);
[height,width,depth] = size(x);
y = x;
done = 0;
iter = 0;
if plotOn
*figure(randi(1000)+1000);*
end
  • Getting error *Undefined function or method 'randi' for input arguments of type 'double'.
Error in ==> meanShiftseg at 27 figure(randi(1000)+1000);
Error in ==> meanshiftdemo at 6 y = meanShiftseg(x,8,10)
  1 件のコメント
dpb
dpb 2013 年 9 月 22 日
You've aliased the builtin randi function somehow...
To check first
which randi
Or, just
clear randi
and try again

サインインしてコメントする。

回答 (1 件)

Image Analyst
Image Analyst 2013 年 9 月 22 日
The call to randi() is fine - check it yourself by typing randi(1000) into the command window. The problem is randi(1000)+1000 is some random number. But you don't have a figure with that handle ID number. You may have figures with handles of 1, 2, 3, etc. but you don't have one with an ID of 1397 (some random number). Don't even call figure unless you already have multiple figures and you need to switch to a specific one because functions like plot(), bar(), scatter(), etc. will automatically create a figure if one is not open yet. So just get rid of it.

カテゴリ

Help Center および File ExchangeRead, Write, and Modify Image についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by