I want to add a file say abc.m in matlab default search path without modifying its path.
So I put the file in one of the folders of my default search path. But still matlab doesn't recognizes when I type the file name on the terminal. Any suggestions.
Here is the folder in which I put my file C:\Program Files\MATLAB\R2011a\toolbox\local
Here are the contents of abc.m
restoredefaultpath;
clear all;
clc;
I am not looking for answers like edit startup.m and use addpath to add the file path .
I got my error.
I forgot to restart the matlab instance so that it could index the files in its default search path
Related
In my code I want to indicate paths to files that are independent on which computer the code is run. In other words, I want the script to operate only in the folder where it is located because my friend's computer can have different drive names, folders' names etc. The task is to load files by indicating where they are located. I thought this would work: "load("..\Folder\file.mat")". However, Matlab gives an error
Error using load
'..\Folder\file.mat' is not found in the current folder or on the MATLAB path, but exists in:
D:\D (synced)\Folder 3\Matlab
D:\D (synced)\Folder 3\Data
Change the MATLAB current folder or add its folder to the MATLAB path.
I checked and file.mat is in Folder which is located in the same directory as the script that I run.
Could someone tell how to make all paths independent on what computer they are run and avoid the error?
I suppose that both your script and file are in the folder Folder.
To make it operating system independent, you could use mfilename to retrieve the path of your script, and use fullfile to concatenate the path with the file name.
p = mfilename( 'fullpath');
file = load( fullfile( p, 'file.mat'));
I am trying to install q in a directory other than my home directory. Is this possible? It seems q will fail if it is in another directory. I get this error when trying to run it:
'/Users/cammil/q/q.k. OS reports: No such file or directory
0::
`/Users/cammil/q/q.k
Set your QHOME to directory which contains q.k file. That should solve the issue.
Also, if that directory does not contain k4.lic (license) file then set QLIC to directory containing license file.
Read more details about environment variables here: https://code.kx.com/q4m3/14_Introduction_to_Kdb+/#1481-the-environment-variables
KDB+ uses the QHOME environment variable at startup. QHOME specifies where to find the q.k file, and if it is not defined kdb will by default look into the home directory. It will also look for the licence file in the same way. Therefore you must define your QHOME variable as the directory which holds the .q.k and k4.lic files. (Or alternativley you can define the QLIC variable for the license)
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
I am running MATLAB 2013b on a CentOS machine. Right now I have startup.m set to cd me into another directory, lets call it shared, where I keep all of my code. I also have pathdef.m set to add shared and some of its subdirectories to the MATLAB path.
The problem is that once MATLAB is open and I check the path settings, ~/matlab has also been added to the top of the path list, ahead of shared. The home folder is where I keep some old versions of code, so it causes the wrong version to be run sometimes. I've double checked my pathdef and startup files, and the ~/matlab directory is definitely not listed. What could be causing MATLAB to automatically add this directory to the path, and how can I fix it?
I have just run Doxygen from the command line and am unsure where it put it...
It doesn't show up in the directory I ran it from
Is there an easy way to find it?
From the Doxygen manual:
The default output directory is the directory in which doxygen is started. The root directory to which the output is written can be changed using the OUTPUT_DIRECTORY. The format specific directory within the output directory can be selected using the HTML_OUTPUT, RTF_OUTPUT, LATEX_OUTPUT, XML_OUTPUT, and MAN_OUTPUT tags of the configuration file. If the output directory does not exist, doxygen will try to create it for you (but it will not try to create a whole path recursively, like mkdir -p does).
If you are having some problems getting it to do what you want use doxywizard it makes writing the configuration file much easier.