Fatal Error: "MATLAB_PREFDIR must be an absolute path. Cannot set preferences directory to the relative path.." occurs when spmd is used - matlab

I am running a program on Matlab and I use spmd to parallelize my code.
The same code runs on 2 different PCs. One of them runs perfectly well, but the other doesn't and the Fatal Error occurs.
If I try to run a non-parallelized program, there are no errors. I don't know if there is a problem with this specific command or if I did something wrong myself.
Could it be related to the directories in which I have saved my code files?
If so then why does the non-parallelized program run?

I'm not sure if you still have this problem, but anyway...
The problem is with the path to preferences folder. So, you need to change it.
Mostly such error occurs if you don't have write access to this folder or its located in hidden folder.
To open the current path of the prefdir type winopen(prefdir) in matlab Command window. Then copy all files from this folder into new one (for instance C:\MATLABPreferences).
Now you need to change a path of the prefdif using .bat file with the following text:
fullfile (matlabroot, 'bin', 'matlab')
set MATLAB_PREFDIR=<New preference folder location>
"<MATLAB executable location>"
Example:
fullfile (matlabroot, 'bin', 'matlab')
set MATLAB_PREFDIR=C:\MATLABPreferences
"C:\Program Files\MATLAB\R2013b\bin\matlab.exe"
Run it and enjoy parallel computing with matlab.
More detailed explanation you can find here.

I've had problems with this, and so far the internet was not really useful. After hours of Googling, this turned out to be useful. You just need to add a new variable to your environmental variables (in case you are using Windows) named MATLAB_PREFDIR with the location of the preferred directory.
For me, it is C:\Users\Balázs\AppData\Roaming\MathWorks\MATLAB\R2014a, but you can get if you type prefdir into matlab's command line.

Related

Why i keep getting all the system paths when i startup the cmder?

I'm new to cmder so excuse me if it's a basic question.
So when I open cmder, I keep getting these PATHS as "were unexpected at this time"
An image for the paths that load on startup:
I tried to extract cmder to another folder, delete them from user/system variables and add them according to cmder-github-wiki but I kept getting the same bug/error/hint or whatever it is.
I don't know if it affect my workflow or not but I hate seeing errors before I begin anything! xD
1:
Try the following:
Check your PATH variable for syntax errors, especially near any occurance of Python related things.
Check something like an "autostart.bat" that CMDer runs at every start. The culprit may be located there, near any occurance of PATH or invoking files or directories which do not exist anymore.
Please clarify: What exactly are you invoking and in which directory, to start CMDer / to get this output? Which files did you edit and what are the contents of those files?
As last resort try uninstalling and reinstalling CMDer. The execution is probably broken since the move to another directory you described and the problem might be hard to track.

Warning: Your deployed application may error out because file or folder paths not present

I get the following warning when deploying an application with matlab:
[Warning: Your deployed application may error out because file or folder paths
not present in the deployed environment may be included in your MATLAB startup
file. Use the MATLAB function "isdeployed" in your MATLAB startup file to
determine the appropriate execution environment when including file and folder
paths, and recompile your application.
]
I have tried to reduce my application to merely a program that creates a figure, nothing more, and I still get the message.
Note: When I start my application, I get the splash screen and then it crashes.
I have tried deploying with R2016b, R2017a, R2017b. How do I get around this? I have tried using my own startup file, I have used isdeployed as suggsted. Nothing seems to work.
All help appreciated!
Type which startup.m -all in your command window. If you find the file then delete it from the path. Then perform the build process again. It might work.

How to find out current directory and go to a directory in MySQL console?

I have the following instruction in I need to perform to run a web app I that have received:
"Go to the directory where the app is unpacked and type 'gradle jettyRun'."
Sounds simple enough, if you know the commands for finding out your current directory and changing it. The problem is, searching for these basic things only nets a huge amounts of irrelevant answers to much more advanced questions where the same terms are used with a slightly different meaning. So what do they exactly mean by what they say and how do I achieve that? It sound's so simple I'm almost embarrased to have to ask it, yet I'm still dumbfounded by the MySQL command line enough to have to.
This has nothing to do with the MySQL command line (>>>), or MySQL itself. This is simply saying:
Open your terminal or shell. In Windows, this is called Command Prompt.
Change the directory to where the files are located, you do this with the cd (change directory) command.
Next you simply type gradle jettyRun.

MATLAB path doesn't match pathdef

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?

xcopy is not recognized as an internal or external command, operable program or batch file

I have a problem using 'xcopy' command.
I'm building a C# project with msbuild. At the end of the build, a batch file is called to copy my assemblies from Debug/Release to some other folders.
Here is the problem, my build fail and the error log is 'xcopy is not recognized as an internal or external command, operable program or batch file'.
The path is correctly set, xcopy do works from a windows command line and from the visual studio command line (the one set with the project environment).
I tried to set the path in the batch file but it doesn't help.
Any suggestion?
I'm using windows 7
Cheers :)
I encountered the same problem.
It seems to be a problem with the path environment variable within Visual Studio.
When I added a "path" statement to the beginning of my build event, it produced the following output:
PATH=
This seems to indicate that the path is empty within the VS build environment.
When I specify the full path to xcopy like this, the problem went away:
%systemroot%\System32\xcopy ...
I'm not sure what caused Visual Studio to lose it's path.
Set Environment variable PATH = %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\
This is not a problem with Windows 7 or 8. It's actually a problem with applications that update environment variables such as PATH.
The PATH is stored in the Registry as an "Expandable string value" (REG_EXPAND_SZ), but a lot of applications write it back to the Registry as a "String Value" (REG_SZ). If your path contains anything like %SYSTEMROOT%, this will not be expanded into C:\Windows (or whatever yours is) if the path is stored in a REG_SZ.
The fix is simply to edit your path manually from the control panel. You need to make a change (eg add a ; to the end of the path) and then apply it. This will fix up your path in the Registry to be a REG_EXPAND_SZ.
(Go to the System Control Panel and select Advanced System Settings. Edit the Path Environment variable in the lower box, and that should fix it.
You can tell whether your path is broken in this way by opening a command prompt and typing PATH. Your path will be listed. If you can see anything enclosed in % % then your path is not being expanded.
It happened to me after I updated one of my Visual Studio extensions, during which Visual Studio was closed and reopened by the updater. I could no longer properly build my project. I closed Visual Studio and reopened it and the problem went away.
I just experienced this for the first time with a batch file I use to copy an Access front-end app to the user's local machines. Their environment is a mix of Windows 7 & 8 and 32-64 bit machines. I noticed that the xcopy.exe was both in the System32 and the SysWOW64 folders and I wondered if there was some conflict. So -- I copied the xcopy.exe into the folder where the batch file resides and it now seems to be working. Just thought I'd share this.
Eileen
I also had a problem with xcopy (same error message) - with a very simple batch program that I use to backup files to a removable drive. Have been using that program for at least 5 years with never a problem. Then yesterday xcopy is unknown to Win7. The replacement of xcopy with %systemroot%\System32\xcopy at each instance solved the problem. Very strange.
Go to environment variable and correct PATh including ; in last.
It will work, this is not at all related to OS or Technology.
It's working for me, Not even need to restart OS, Just open new command prompt.
[Fixed for me]
After adding the correct paths to "Path" environmental variable it still doesn't work (for cmd and VisualStudio) (even after restarting the PC).
The problem was in broken register parameter:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment]
ParameterName=PATHEXT
I had the value .wlua;.|exe. Maybe was broken after installing something.
Everything works again after changing it to:
.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
Hope this helps if nothing other works.