An error occurred while trying to determine whether "dataset" is a function name.

5 次查看(过去 30 天)
Hi all, I'm using a toolbox called PRTools which I have to use for a course I'm following. Somewhere I have to call a function, and then this function calls a function named 'pr_dataset'. The error I receive is the following: An error occurred while trying to determine whether "dataset" is a function name. I've read some things about not having the right license, which I don't think is the case because this function is in the toolbox that I downloaded, which just has the files in a folder on my computer. Also I've read about problems when using 'addpath' in startup.m. I use 'addpath', but not from the startupfile. I just call 'addpath' at the beginning of the script I'm writing. I also tried adding
%#function pr_dataset
but that doesn't seem to help. Now I've figured out that when I add the folder with the toolbox by using 'addpath', I have this problem, but when I manually add the folder by right-clicking it in the folder structure and adding it to the path, everything works fine. However I'd like to be able to use the 'addpath' because it is very inconvenient having to add the path manually all the time. Does anyone have any clue as to what is going on and how to fix this? Any help is much appreciated.
Kind regards, Iris

回答(2 个)

Usha Duddu
Usha Duddu 2016-1-8
Hi
I understand that you have issues using "addpath" function. Please make sure that you do not have your custom script with the name "addpath.m". This will make sure that pre-built MATLAB script "addpath.m" is not shadowed by your custom script "addpath.m"(if you have one).
Try using "fullfile" function within "addpath" as follows-
>>addpath(genpath(fullfile(pwd,'../external/matlab_xunit')))
Also execute the following MATLAb functions before using "addpath"
>>restoredefaultpath
>>rehash toolboxcache
Hope this helps
Thanks
Usha
  1 个评论
Iris
Iris 2016-1-12
Hi, thanks for your answer. However I do not understand how you chose your arguments for the fullfile function? Also, if I choose to use restoredefaultpath before using addpath, I go back to the default matlab folder which is not the folder I work from, so that seems a bit inconvenient. This does seem like a complete solution to me though, so I hope you can explain this to me a little further. Kind regards, Iris

请先登录,再进行评论。


Walter Roberson
Walter Roberson 2016-1-8
You wrote,
An error occurred while trying to determine whether "dataset" is a function name
Notice that refers to "dataset" not "pr_dataset". So you need to %#function dataset
(and you would need to have the Statistics toolbox as that is what defines dataset)

类别

Help CenterFile Exchange 中查找有关 Calendar 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by