How to avoid warning and make addpath work in R2012b
2 次查看(过去 30 天)
显示 更早的评论
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.
回答(1 个)
Image Analyst
2013-4-18
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Search Path 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!