Re: matlab a function in m-file




"akira32.comp.soft-sys.matlab" <rikcuo32@xxxxxxxxxxxx> wrote in message
news:1175342475.318186.225890@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I write a function called improd in m-file(bb.m).

% in bb.m file
function [ p, pmax, pmin ,pn ] = improd ( f, g )
% help22
fd=double (f);
gd=double (g);
p=fd.*gd;
pmax=max(p(:));
pmin=min(p(:));
pn = mat2gray(p);

But when I call improd function,it appears the error about Undefined
function improd.

f=[1 2 ; 3 4];
g=[1 2 ; 2 1];
improd(f,g);
??? Undefined command/function 'improd'.

How do I let matlan know that I have declare a fuction in m-file and I
want to use the function?


btw, the standard is to name the m file as the same name of the function
inside the m file.
Try to do that first. i.e. rename the m file as improd.m

If you still have problem then try to update your Matlab path to include the
folder where this m file is located and try again to call it.

File->Set Path

Nasser


.