Borrar filtros
Borrar filtros

Have I done some mistake in the following line

1 visualización (últimos 30 días)
Poonam
Poonam el 22 de Sept. de 2013
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 comentario
dpb
dpb el 22 de Sept. de 2013
You've aliased the builtin randi function somehow...
To check first
which randi
Or, just
clear randi
and try again

Iniciar sesión para comentar.

Respuestas (1)

Image Analyst
Image Analyst el 22 de Sept. de 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.

Categorías

Más información sobre Read, Write, and Modify Image en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by