Is it possible to have Matlab editor, without having the whole Matlab?
The warnings that Matlab editor provides are useful for me in coding, but I can not afford buying Matlab. How can I only use the editor? Does it still give warnings?
You could use GNU Emacs. Configure Emacs Octave Support. Then M files, within Emacs, will have syntax highlighting and indentation. You will not have in-editor warnings as in the MATLAB editor.
You could use Octave to run and test your M files. For simple scripts and functions, little to no modifications will be required to go from MATLAB to Octave, or vice versa. The same is not true for MATLAB code that implements GUIs or some of the more specialized toolbox.
You could certainly use a text editor to edit matlab files, as long as you save them with the .m extension. Unfortunately, as Matlab is the only program that can interpret the file, you won't get warnings as you work.
As an alternative, you could get FreeMat (http://freemat.sourceforge.net/) and work with .m files with proper syntax highlighting. However, FreeMat does not have the vast library of functions that Matlab has, and still won't provide you with warnings as you code.
Maybe you could work with Matlab in your institution's library (if you're a student), or get your business to pay for it (if you're a professional)?
Related
I'd like to use a Continuous wavelet transform (CWT) function in my octavegui code.
in Octave gui CWT is not available - is there equivalent .pkg to use a cwt?
fwt is available in the ltfat.pkg- but this seems to be something different than cwt.
According to the pdf from Prusa a form of a CWT is a Morlet or a mexican hat ("Continuous Wavelet Transfom – CWT (Morlet, Mexican hat, . . . ).= - is it possible to use a Morlet function in Octave? or is this something different?
any suggestions? (I am not a mathematician)
thank You
If none of these functions cover your needs, then you have two other options:
Use a c++ or java package within octave. Octave has external interfaces for both.
Use a simple python / julia / whatever scripts to perform specific calculations using your favourite wavelet package natively in that language, and use .mat converters to pass data (e.g. scipy.io.loadmat / savemat in python, and MAT.jl for julia) in and out of octave. Octave provides a 'python' function for executing python scripts for convenience (but this is no more than a nicely wrapped system call).
In any case, unfortunately that does mean you would need to know a bit of python / c++ / java respectively.
You can find a nice list of wavelet packages here.
Another thing you could try, is scilab. It is similar to octave (though not identical), and provides a wavelet package. There's also a module which allows intercommunication between octave and scilab.
Do have a look at the octave forge list first though. It's been a while, but last time I worked with wavelets I remember those covered my needs more than adequately.
PS. I did not mention Wavelab above, because their website does not mention this, and I don't know if it actually works on octave. Also, it seems a bit outdated. But in theory there's no reason why it wouldn't work, might as well give their .mex files a try if it seems relevant to you.
PS2. If something works for you, feel free to leave a comment here for future readers.
I did not find any suitable answer or hint, so I am asking this here now: Is there any alternative editor for Matlab with a dark theme (easier to the eyes), that supports integration in Matlab for proper debugging, autocompletition etc.? And if so, how do I setup those editors on windows?
I am really annoyied of the default matlab text editor. The color theme can not be applied to the whole IDE and the syntax highlightning is really bad, because it can not distinguish between numbers, brackets, operation-symbols (=,+,- etc.) and more like that. It is sometimes really hard to read a matlab file in the default editor, because the lack of these basic features.
Thanks!
Looking back at my own question, I will try to give an answer. There is no way to define individual colors for matlab-code in matlab itself. Therefore I stick with Notepad or Atom, which have far superior color syntax even for matlab code. For running the code, you have to switch to matlab of course. This for sure no optimal solution, but the best to get better readability for matlab code.
As you may know, extrinsic functions are not outputted during the code generation process. Are there alternatives to these functions and/or solutions to this problem? My code generation error report is shown below :
Code Generation Error Report
I am surprised that I can't output size and rgb2gray either. Since these are essential to my program, I cannot avoid them.
Help will be much appreciated!
This is a good question, and I see similar questions fairly frequently. As I started using MATLAB Coder, one of the biggest pitfalls was the constant search for supported functions. I sympathize with your frustration, and I have a few tips, having been through this.
First, to your direct question, while imread isn't supported by Coder, size and rgb2gray are. Probably Coder is complaining about these because they have been passed mxArrays from the call to imread, which is fine when it is extrinsic, but not ok for separate generation. That's just a guess. A very useful tool in writing code is the list of Coder supported functions: List of Functions supported in MATLAB Coder
But even with those two, to replace imread is not a tiny task. You'll have to find another library that supports the particular file you're working with, and then stitch that in using coder.ceval. Alternatively, if you can find a pure MATLAB implementation of it, that might help.
Are you targeting a pure C library or a MEX file? If you intend to use this code within the MATLAB environment, you can always use imread separately and then pass the data.
And now to some more general observations: MATLAB Coder isn't a perfect MATLAB to C translation system. It's extremely powerful, and I've been able to write some very large projects with it, but if what you want is the ability to run any MATLAB code without MATLAB around, you should look at MATLAB Compiler, a different add-on. There's a very good Q and A about this here: MATLAB Compiler vs MATLAB Coder
When writing projects in MATLAB Coder, it's really best to start from scratch, knowing you're targeting C code ultimately. There are so many gotchas in the conversion from MATLAB to C that you have to be always vigilant while writing the MATLAB code.
One tool that helps is to right-click on a file in the "Current Folder" list that usually resides on the left-side of the main window, and select "Check Code Generation Readiness." You'll get a great report of potential problems in the file. I recommend using this often.
Another useful tool is to always put the %#codegen tag into your code. This alerts the MATLAB editor that the .m file is intended for code generation, so it provides extra context-sensitive information while you're writing the file. This helps enormously.
The most commonly missing functions for code generation are file IO functions. There are some good reasons for this, but it's frustrating nonetheless.
When you stitch in external C code, you use the coder.ceval function, which can provide excellent access to external libraries. Using this well is a whole other topic, outside the scope of this question.
If you can indicate exactly what kind of files you're interested in reading (PNG, BMP, TIFF, etc.) perhaps someone may be able to identify a good external library for you to use.
I found mathscript can do this,but it seem too slow.
So I want to use matlab to create a dll file used by labview,but all information I can find just how dll could used in C++,but C++ also must use the .lib file ,I am concerned labview could not use lib. file.
So can I use the .dll in labvew,and how?Is there anyother way to use matlab source code in labview without matlab?
You will need to purchase the MATLAB Compiler which is quite expensive unless you are a student.
You can also call the MATLAB application (if it's installed) using the MATLAB Script Node (which is different than Mathscript) - see here
Another alternative is Python's Numpy which I personally picked up quickly coming from a MATLAB background. If you want to go down that route I can give you further advice on how to integrate with LabVIEW.
I'm trying to run a program originally tested on Matlab 6.5 on a new release (R2009a)
The program uses some mex files, and I get the following error when trying to run it:
??? Invalid MEX-file '/normalizedCut/common_files/sparsifyc.mexglx':
normalizedCut/common_files/sparsifyc.mexglx: symbol mxGetIr, version
libmx.INTERNAL not defined in file libmx.so with link time reference.
(the code I'm trying to tun is Normalized cut by Shi & Malic, and can be found here:
http://www.cis.upenn.edu/~jshi/software/files/NcutClustering_7.zip)
If I try to run the code on the same system but Matlab 2007a it runs ok.
Is there some problem with backwards compatibility for 2009a?
Are there any flags somewhere in the system I can change to help it work?
When I googled it I saw some references to the LD_LIBRARY_PATH env variable, but what exactly should be added to it I could not find out.
Thanks,
Yair
The source code for those mex functions appears to be available in the "Image segmentation with normalized cuts" source on this page: http://www.cis.upenn.edu/~jshi/software/ (in the specific_NcutImage_files subdirectory in the unpacked .zip)
It's pretty common for there to be problems running mex functions with different versions of Matlab. The errors you're getting look like they're due to API changes in Matlab (though that surprises me a little). I've had the most trouble because of binary incompatibilities induced by changes in gcc. I'd suggest contacting Jiambo and asking him if he can build a new version or release the source.
Worst case, you could try re-implementing those mex functions. The normalized cut algorithm is pretty straightforward in Matlab (see the Shi and Malik paper). By the names of the mex functions, they look like they're mostly duplicating existing matlab functionality (matrix multiplication, matrix sparsification). There's a non-zero chance that if you re-implemented them as regular m-code functions they'd be faster anyway due to the multicore support that's been added to Matlab.