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

10 views (last 30 days)
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

Answers (2)

Usha Duddu
Usha Duddu on 8 Jan 2016
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 Comment
Iris
Iris on 12 Jan 2016
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

Sign in to comment.


Walter Roberson
Walter Roberson on 8 Jan 2016
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)

Categories

Find more on MATLAB in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!