Have I done some mistake in the following line
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaire
dpb
le 22 Sep 2013
You've aliased the builtin randi function somehow...
To check first
which randi
Or, just
clear randi
and try again
Réponses (1)
Image Analyst
le 22 Sep 2013
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.
0 commentaires
Voir également
Catégories
En savoir plus sur Read, Write, and Modify Image dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!