I can't open live script examples

Error using mkdir
Sistem belirtilen dosyayı bulamıyor.
Error in exampleUtils.setupWorkDir (line 4)
mkdir(workDir)
Error in setupExample (line 18)
exampleUtils.setupWorkDir(workDir);
Error in openExample (line 29)
I've got this error when i tried to open live script examples. When i clicked "view MATLAB command" button and following the instructions, gave me the error. One of the example is "Plan and Execute Task- and Joint-space Trajectories using KINOVA Gen3 Manipulator". How can i open and run this example on matlab? Is the example folder missing? If it is, how can i get the folder? And how can i insert the kinova robotic arm to matlab like the example shows?
I added a link the example which i wanna open. Can you help me,pls? It's so important and urgent for me.

 Accepted Answer

It appears to me that the code attempts to use "userpath" followed by Examples followed by your MATLAB release, followed by an example-specific directory name, and creates that directory if it does not exist. It appears to me that it is failing to create the directory.
One way that could happen is if your "userpath" does not exist. userpath is
% Windows: user's "Documents" folder appended with "MATLAB"
% Mac: user's "Documents" folder ($home/Documents) appended with "MATLAB"
% Linux: user's $home folder appended by "Documents" and "MATLAB"
You should check to see if that directory exists.
(On MS Windows systems in corporate environments, I have seen cases where the directory does not exist, when the user has been restricted to writing into network filesystem directories instead of local directories.)
In the meantime, there is a work-around:
openExample('robotics/PlanAndExecuteTaskAndJointSpaceTrajectoriesExample', 'workDir', 'NameOfDirectoryToUseForTheExample')
where 'workDir' is the literal string, and NameOfDirectoryToUseForTheExample should be replaced by the fully-qualified directory name to use . You should use a different directory name for each example.

3 Comments

Thank you so much for your answer!! I'm so appreciated. Most of the examples ran with your method. Documents folder was empty while run the examples then the directories are exist in the folder. I say "Most of the examples.." because I can run nearly all of them but there is an example doesn't run. I tried over and over but doesn't run. If i drop the link below, can you help with that one once again pls? :) (Win10, r2019b)
openExample('robotics/PlanAndExecuteCollisionFreeTrajectoriesExample', 'workdir', 'PlanandExecuteCollisionFreeTrajectoriesusingKINOVAGen3Manipulator')
It is my version with your way, but i don't understand why it doesn't work with that one like the rest. I added the error here.
Error using copyfile
Sistem belirtilen yolu bulamıyor.
Error in exampleUtils.copyIfMissing (line 8)
copyfile(src,target,'f');
Error in exampleUtils.setupMainFile (line 5)
exampleUtils.copyIfMissing(src,target);
Error in setupExample (line 21)
exampleUtils.setupMainFile(metadata, workDir);
Error in openExample (line 29)
workDir = setupExample(id, workDir);
That one works for me on my system.
I would suggest using
dbstop if error
and running until it stops, and then examine src and target to try to figure out what is going wrong.
That one works too, thank you!!

Sign in to comment.

More Answers (0)

Products

Release

R2019b

Community Treasure Hunt

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

Start Hunting!