This question already has answers here:
How can I generate a list of function dependencies in MATLAB?
(2 answers)
Closed 8 years ago.
Assume I have written two MATLAB functions foo.m and bar.m
I want to know if foo.m calls bar.m
I tried using depfun and listing dependencies and checking if bar is a member. It didn't work.
It seems depfun only returns builtin functions.
Is there a way around this when bar.m is not a built in function?
There are various techniques listed in the documentation to identify file dependencies, one of them should do the trick.
Note: the techniques listed in the documentation page I mentioned are for the latest release R2014b, they may not all be available in earlier releases.
Related
This question already has answers here:
Can I dynamically get a list of functions or function names from any Perl module?
(3 answers)
How do I list available methods on a given object or package in Perl?
(5 answers)
List all the subroutine names in perl program
(3 answers)
Get list of methods/functions defined explicitly in a module
(1 answer)
Closed 6 months ago.
First of all, I am entirely new in perl so I apologize if this is a rather basic question.
We have a perl script that calls on a module — lets name it module_x
It’s called in the script using this line.
require module_x
Sadly, this does not have a documentation and we can’t access the server where this script is.
Is there a way to know what functions are available in the module? Similar to desc in python.
This question already has answers here:
How to execute multiple statements in a MATLAB anonymous function?
(5 answers)
Closed 7 years ago.
Is it possible to create multiline anonymous function in Matlab?
There are no appropriate examples in documentation, but also no direct denials. In web discussions I found some derisions of askers as if it silly wish. Nowadays, when most languages introducing lambda expressions with multiline capability this looks strange.
No, unfortunately this is not possible.
This question already has answers here:
Go back to last state
(2 answers)
Closed 8 years ago.
I would like to save the state of a Lisp compiler so that I need not load my file in several minutes, but instead I would load that image in seconds.
Which Common Lisp compiler would do this favor for me?
I came to this idea as Standard ML of New Jersey does this: Exporting Heaps.
I could not find similar in the sbcl manual or the
ecl manual.
With SBCL, use save-lisp-and-die. To restart the image, use the --core arguments.
Read carefully the caveats in the documentation.
With CLISP, use EXT:SAVEINITMEM
This question already has answers here:
Is it possible to execute compiled code both within and out of MATLAB environment?
(2 answers)
Closed 6 years ago.
I've got a MATLAB project, which I compile in order to have a single executable file, using MCC.
Then I would want to know if it's possible for an external programmer to execute some of his .m files within the .exe, without re-compiling the whole project.
The point is to provide an application in which other developpers could add their "plug-ins", written in MATLAB.
I've searched a way of running external .m files inside compiled MATLAB application (like this thread : Running an .m file from a MATLAB-compiled function) but it doesn't fit my purposes here, altough it's working fine using eval().
But this eval() "trick" isn't sufficient, as it doesn't allow to define new functions or classes.
For instance, I would like external .m files to be new classes (inherited from compiled "interfaces" in the executable).
Is there a way to dynamically load .m files into a MATALB compiled executable ?
(even if it needs a MATLAB licence to do such).
And/or is there some "undocumented MATLAB" that refers to this particular topic that I could investigate further ?
Regards,
If you were able to create and distribute a compiled application that could execute arbitrary .m files, your users would be able to do pretty much anything MATLAB can do, but for free (even if that wasn't your intent).
Providing them with that capability (even if you intended something more innocent and useful) is against the license agreement for MATLAB Compiler, and MathWorks also put in place some technical restrictions to make it difficult to do so.
You might find a partial way around some of the technical restrictions, but if you give your users the ability to execute arbitrary m-code in a plugin, you'll be in breach of the license.
(Of course IANAL)
I think that the only way is to do some system calls from your compiled function, like:
mFile2Launch='foo'; %%% or whatever input
system(['matlab -r "' mFile2Launch '"']);
or you can also use that more complicated line to make sure everything work well:
system(['matlab -nodesktop -nosplash -nodisplay -r "try, ' mFile2Launch '; end; quit"'])
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
This question is related to my previous one: MATLAB m-file help formatting.
What do you usually write to describe authorship of your own function? Do you put it at the end of the function body or right after the help text before any code?
How do you include version information? Is it possible to automatically update version after function modification?
This is what I usually include:
% My Name <my#email>
% My company
% Created: September 2010
% Modified: October 2010
Please share your thoughts, ideas?
I have a function in the MATLAB Central File Exchange that helps you document your function in a standard way, and works with version control software (CVS and Subversion; not git) to automatically update the author field and time of modification.
You just type new at the command prompt, then the name of the function, and it sorts out the rest.
The basic template for documentation that I use is
function [outputArgs] = TestFunction(inputArgs)
%TESTFUNCTION Summary of this function goes here
%
% [OUTPUTARGS] = TESTFUNCTION(INPUTARGS) Explain usage here
%
% Examples:
%
% Provide sample usage code here
%
% See also: List related files here
% $Author: rcotton $ $Date: 2010/10/01 18:23:52 $ $Revision: 0.1 $
% Copyright: Health and Safety Laboratory 2010
(You'll obviously want a different company in your copyright statement.)
The first line of the help documentation is known as the H1 line, and is used by the function lookfor, among others. It is important that this comes straight after the function definition line.
If you have different use cases (maybe with and without optional arguments), then you should describe each one.
The Examples: and See also: lines are formatted in a way the works with the help report generator. (I've just spotted a bug - the year should be before the company name in the copyright line. Fix on its way.)
$Author:, etc., are formatted for use with CSV/SVN. Since git uses hashes of files, you can't change the content of the file, without git thinking that it's been updated.
We keep our code in a Subversion repository and use the keywords functionality for writing this sort of information into the header comments of the m-file when it is committed to the repo. We put a block of comments right after the initial function line in (most of) our m-files.
If you are not using a source code control system then:
You really should start using one right now.
You could write a script (in Matlab, why not) for maintaining the comment information you require, and implement some process to ensure that you run the script when necessary.
We don't generally put modification dates or histories in our source files, the repository tracks changes for us. Which is another reason you should be using one.
And, while you are thinking about all this, if you haven't already done so: check out Matlab's publish functionality.
EDIT: #yuk: I guess from your mention of TortoiseSVN that you are working on Windows. It's a couple of years since I installed Subversion on my Windows PC. I don't recall any problems at all with the installation, and I'm not qualified to help you debug yours -- but there are plenty on SO who are.
As for keeping version (etc) info up to date, there's no scripting required. You simply include the special strings, such as $Rev$, which Subversion recognises as keywords in the locations in your files (probably in the comments) where you want the version information (etc). This is well explained in the Subversion Book.
As for the Matlab documentation, I think the publish (and related) features are well explained in the Desktop Tools and Development Environment handbook which is available on-line at the Mathworks web-site.
As High Performance Mark points out, some form of source code control is ideal for handling this situation. However, if you are adding information by hand here are a few pointers:
I would definitely include a line stating the MATLAB version your code was written in, or perhaps which versions you know it works for.
When adding the information, you have to leave space between it and the help comment block if you don't want to display it when the user views the help contents, like so:
function myFunction
%# Help text for function
%# Your information
Unless you do want it displayed with the help. Then just make one big comment block.