What is "." in matlab search path? - matlab

I'm trying to set up the search path of my laptop matlab. I saw "." in my office computer matlab(set up by someone else).
What does . mean?
How can I add . also as my search path. I tried to add it but it failed.

There are two methods for specifying paths: absolute and relative paths.
An absolute path is e.g. C:\some\folder in Windows, or e.g./Some/folder in Linux and Mac. As the name says, these are absolute and always the same. Relative paths however are paths specified in relation to the current working directory.
When creating relative paths, . is the current working directory. .. similarly is the parent directory. This can be used to add subfolders to the path, e.g. ./subfolder or add another directory which in located in the parent directory, e.g. ../other_directory.
Afaik, you don't need to add the current working directory to the search path, as this is the default behavior of MATLAB.

Related

Vscode open file with "ctrl-click" with relative paths

I have a .yaml file that has a key value pair, the value being a string with a note saying see <filepath>.yaml
I want to be able to "ctrl-click" on the file to open it, and this works with absolute paths e.g.: See file:///c:/dev/<rest of path>/<file>.yaml
Is this possible with relative paths? How is vscode treating the root folder? Can I set a root folder for file:/// to look for first?

Adding a Folder path in Matlab to access a different folder with Matlab data on Mac

I am trying to load a folder path on mac to a folder of MATLAB data sets.
This is the code I am using:
folder_path = '/Documents/2020/Root Locus/Data';
files = dir(fullfile(folder_path,'*.mat'))
The file I am running the code from is located in the root locus folder. My files variable keeps appearing empty as nothing has loaded to it, any help?
You need to write the path as either the relative path from Matlab's current folder or the absolute path for the system. An absolute path will start with / and specify the location from the topmost system directory. Relative paths do not start with /.
If you are running Matlab from Root Locus, then try folder_path = 'Data';
The absolute path makes the code more portable, so also try folder_path = '/Users/<username>/Documents/2020/Root Locus/Data';

How to specify path in .config file relative path to folder?

I have folder "NuGetPackages". I need to access only the folder on my computer is OK but on server is different folder structure where the project is store
what i use on my computer absolute path:
C:\workspace\HUD\02_Development\04_Tools\NuGetServer\NuGetPackages
What should I write in the config file to make sure the path is ..\NuGetPackages expanded relative to the config file rather the working?
directory?
I can't change the app I can only change the config file.
I have also try "~/NuGetPackages" but didn't work.
In short, you can't do exactly what you're trying to do.
If you can't change any of the code, your only real option is to use config transforms. You can have your *.Debug.config use your local path, and then your *.Release.config (or whatever your published build configuration is), and use the server's path.
Here are some docs on doing config transforms: https://msdn.microsoft.com/en-us/library/dd465326(v=vs.110).aspx

To delete a file, located in the search path, in MATLAB

I have a file located in /path/to/Matlab/myData.mat. The path /path/to/Matlab has been in the search path. I launch Matlab from /path/to/Matlab/workspace/.
However, the command if (exist('myData.mat','file')==2) delete('myData.mat'); returns error saying that File myData.mat cannot be found.
There is only one file named myData.mat among all the search paths. Is it mandatory to use absolute or relative path when call the delete() function providing the location has been added to the search path?
My OS is Ubuntu 16, and Matlab v2015b.
Use which to find the full path

Relative files paths in doxygen-generated documentation

I am using Doxygen 1.7.4 for Windows.
In the File List page of generated documentation I'd like to see relative paths.
I have set FULL_PATH_NAMES = YES, to have something more, than just filename without path, but this gives full, absolute paths.
I want only paths relative to project directory. I know, that I can use STRIP_FROM_PATH but I have problem with wildcards. I need that kind of path-stripping, because this project is made on multiple PCs (as git repo), so paths can be different.
Is it possible to use wildcards for this setting, or do I have to set doxyfile for each workstation with part of absolute path to strip?
Edit:
I've found something like what I need on the doxygen website: STRIP_FROM_PATH = $(QTDIR)/
Maybe it is possible to use one of doxyfile's variables?
I'm not sure about Windows, but on Linux and OS X I can produce outputs in the file list like
src/Utils.cpp [code]
src/Utils.h [code]
src/VectorMath.h [code]
test/src/test.cpp [code]
By setting FULL_PATH_NAMES to YES and STRIP_FROM_PATH to ../.. (i.e. the directory path of project's root which is two directories up from where I'm building the docs). You may need to swap the directory separator to the windows one.
You'll also need to watch out that you update the Doxyfile if you move the docs around.