Undefined function or variable 'skript_name' Matlab - matlab

I'm using an open source code from Matlab: http://makerzone.mathworks.com/uncategorized/activity-detection-with-matlab/
for activity detection. All data that I need is in the zip file that you can download above. When I try to run the main script activityDetection.m that classificate the data it shows this error: Undefined function or variable 'activityDetection'.
maybe knows someone how to fix it :)

I downloaded zip file and then run it on my laptop. It works just fine.
You need to change your working directory to the directory where the code is (or add the directory to your MATLAB path by typing addpath('ADRESS TO DIRECTORY')).

Related

[Neo]Vim can't open sourced file

So I've got the following init.vim under ~/.config/nvim/
source plugins.vim
plugins.vim lives in the same directory.
When I'm opening [Neo]Vim I always get
Error detected while processing /home/luke/.config/nvim/init.vim:
line 1:
E484: Can't open file plugins.vim
Does anybody know what I am missing?
The path for source command is always taken relative of the current working directory. Hence, you should specify full path instead. For example,
source <sfile>:h/plugins.vim
Another possibility is using runtime command that does searching along the 'runtimepath'. E.g.
runtime plugins.vim

Xcode New "Run Script Phase" - How to handle output files?

I want to add a Run Script Phase to my Build Phases to call a swift executable that takes a plist file from my project and uses it to generate a swift file with some boilerplate code.
I figured out how to specify the input file for the Run Script Phase like this:
$(SRCROOT)/MyProject/MyData.plist
But for output files, Xcode gives me this $(DERIVED_FILE_DIR)/newOutputFile default value which, if I echo it via echo "$SCRIPT_OUTPUT_FILE_0", prints some strange path to the ....MyProject.build/DerivedSources folder. What is that? What do I do with this and how can I generate my output swift file and place it inside my project?
I don't really find much information about this $(DERIVED_FILE_DIR) (at least nothing that I understand, I've never worked with these things before).
Thanks!
Presumably the derived file directory is just a safe place to write output results to. It isn't in the project directory, but it is unique to the project.
However, you do want to write directly into the project directory (I presume), so just go ahead and do so, using the environmental variable PROJECT_DIR.

Change simulink rtwbuild output folder

I'm automating my build process, but I wasn't able to change the model_target_rtw folder to something different.
I'm not talking about CodegenFolder, but about the folder that's created inside it during compilation.
I'm currently working this around by renaming the folder after compilation, but it would be grate to remove that step.
The folder you are referring to is the RTW (Real Time Workshop) BuildDirectory.
You can get the value of BuildDirectory by running the command:
RTW.getBuildDir('MyModel')
See:
https://se.mathworks.com/matlabcentral/answers/274082-how-can-i-change-the-build-folder-of-a-model
Also look at this question:
Save generated code in a special folder in "rtwbuild"
If you run this command in MATLAB:
set_param(0, 'CodeGenFolder', 'C:\MyBuildDir')
and then run the RTW.getBuildDir command again you will see that the BuildDirectory has changed.

rtw.codemetrics.C_CodeMetrics' contains a parse error or cannot be found on MATLAB's search path, possibly shadowed by another file with the same name

I am deploying my project using deploytool in MATLAB. I added few function files with main.m file and run the build. It stoped on build failed and return an error:
rtw.codemetrics.C_CodeMetrics' contains a parse error or cannot be found on MATLAB's search path, possibly shadowed by another file with the same name.
Please help ....Thanks in advance.

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

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.