How to avoid warning and make addpath work in R2012b
2 views (last 30 days)
Show older comments
I need to have different paths for different projects. What I used to do is to change path in pathtool, go to the working folder of the current project, and save the path there, using
savepath pathdef.m
Then, if I come back to the project, I changed the current folder to the project folder, and did
addpath('pathdef.m');
That restored path for the current project. This way doesn't work anymore for R2012b. It produces warning
"Warning: Directory access failure: pathdef.m"
and does not change the path. The solution I found is to use
addpath(pathdef());
instead.
Answers (1)
Image Analyst
on 18 Apr 2013
See this code snippet of mine. Then read the directions carefully to find out the ID number of your error message, then adapt the code to turn off that particular warning. It's safer to do that than to turn off all warnings.
% Turn off this warning "Warning: Image is too big to fit on screen; displaying at 33% "
% To set the warning state, you must first know the message identifier for the one warning you want to enable.
% Right after your line of code generates the error,
% query the last warning to discover the warning identifier. For example:
% warnStruct = warning('query', 'last')
% messageID = warnStruct.identifier
% In the command window, this will show:
% messageID =
% MATLAB:concatenation:integerInteraction
% Pass that into the warning function:
warning('off', 'Images:initSize:adjustingMag');
0 Comments
See Also
Categories
Find more on Search Path 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!