It happens that your application encounters a directory path related to the current folder, or uses a double dot for navigation, for example. C:\A\B\..\C This is obviously equivalent to the canonical path C:\A\C How can one resolve the path to its canonical form?
C:\A\B\..\C
C:\A\C
The easiest way I know to convert the path to its canonical form is the cd command:
cd
oPath = cd(cd(iPath));
Please note that this will not work if the path to your file system does not exist.
This interface uses the java io interface:
jFile=java.io.File(iPath); oPath=jFile.getCanonicalPath;
No need to change the Matlab directory. It has other useful methods that can be found here .
Another way to do this without the potential exception exception is to use the what command:
pathInfo = what(iPath); if ~isempty(pathInfo) iPath = pathInfo.path; end
Source: https://habr.com/ru/post/1498543/More articles:Visualize sparse pattern with intensity using spy function Matlab - graphConvert expression > to expression >> - c #How are upvalues โโcalculated in Lua nested functions? - luaHow to dynamically update a ListView using a custom adapter? - androidProgrammatically install Google Play Services on an Android device - android-locationFilter the contents of a specific tag from a PHP variable? - phpNHibernate Criteria - How to use a group according to the statement? - c #How to authorize Firemonkey form - delphiAuthentication with Windows Azure Active Directory directly without opening a web browser - authenticationHow to use the Azure REST API application with Active Directory authorization in Azure On - c #All Articles