Undefined function 'nmf' for input arguments of type 'double'

i have made a function named nmf its sign is: function [ W,H ] = nmf(A,k,numOfIteration )
when i try to test this fınction with a A=rand(40,30); it says: Undefined function 'nmf' for input arguments of type 'double'
so what is the type of A in my fucntion? i tried nearly all types.any ideas?thank you.

댓글 수: 3

Is the directory where nmf resides on your path? You can check this by selecting File->Set Path and see whether the folder containing 'nmf' is on your path. If it is not, add it using the "Add Folder" button.
Make sure the saved file is named nmf.m
matt you are right.it is not in the path thank you.

댓글을 달려면 로그인하십시오.

 채택된 답변

Wayne King
Wayne King 2012년 10월 16일
As Matt's comment correctly suggests, you have to add the folder (directory) where the function is located to the MATLAB path. If your function is in c:\mfiles for example, use
>>addpath 'c:\mfiles'
or use the
>>pathtool
to add the folder. The type error message is not saying the type is wrong, it's basically saying "you tried to call nmf() on a double input, but I don't know what nmf is".

추가 답변 (1개)

Sachin Ganjare
Sachin Ganjare 2012년 10월 17일

0 개 추천

Probably you are trying to use 'nmf' function instead of 'nnmf' function in statistics toolbox.

카테고리

도움말 센터 및 File Exchange에서 Linear Algebra에 대해 자세히 알아보기

태그

질문:

2012년 10월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by