Octave rasterread vs Matlab geotiffread - matlab

I have some Matlab code that uses the geotiffread function (mapping toolbox). Now I would like to port this code to Octave, and to do that I have to use the rasterread function (mapping octave forge package).
The two functions are not identical: the octave function should provide access to the same information of its Matlab counterpart, but the return values are quite different (structure arrays with different size/shape, fields, ...). Is there any resource, a part from the reference of the two functions, to map geotiffread and rasterread?

Related

Rename variable names in corrplot in Matlab

I have my data as a {instance, feature values} matrix. I want to visualize the correlation of features in Matlab.
Matlab comes with a handy function named corrplot. I get the correlation plot, but with features named as var1, var2, var3 etc., instead of the real feature labels. What is the method of specifying the feature labels to use when plotting the correlations?
I can't test the following since I don't have the Econometrics Toolbox, but according to the docs (and as in many, many, many MATLAB functions) you can provide Name-Value pair arguments to the function in order to set specific parameters.
In your case, you wish to use the varNames argument with an appropriate cell array of strings, here {'instance';'feature';'value'}, and that should do it.
Have fun!

Symbolic notation for functions in Matlab

Is there a way to use actual symbols (like the square root symbol instead of writing "sqrt()" and integral and sum/product signs instead of "integrate", "sum", etc.) as in Mathematica?
Partially, but not within the main part of Matlab.
If you use MuPAD (type mupad in your Command Window), the engine behind much of the Symbolic Math toolbox, you can display/print results from calculations in your notebook with various levels of formatting. However, it does not appear that one can display what one enters with such formatting. Like Mathematica, MuPAD does have a graphical toolbar interface for selecting various commonly used types of mathematical operations.
Matlab was originally developed as a programming environment for numerical calculations and programs, whereas Mathematica was developed primarily as a tool for mathematicians to perform symbolic math and typeset their equations in a virtual notebook.
Aside: Though the MuPAD environment is distinct, one can access all of it's fuctionallity from within Matlab. See here for how to call MuPAD functions. Some examples: 1, 2, and 3.
Nope - it's how MATLAB was written. As far as I am aware, Mathematica is the only tool that uses symbolic notation for actual code.
I think a problem with having symbols instead of code is that you now need a way of writing those symbols (a menu bar, a tablet input, etc.) that would make it extremely cumbersome for a user.
Matlab is based on its diversity of toolbox, one of the toolbox support the symbolic notions you mention is the Symbolic Math Toolbox.
The Math Toolbox includes the MuPAD language. MuPAD is similar to Mathematica language, and here is a basic tutorial of MuPAD tutorial
In addition to Matlab, if you want Symbolic notation, IPython Notebook also use the actual Symbols. And it is faster, newer and easy to use.
Hope this will help you.

MATLAB's glmfit vs fitglm

I'm trying to perform logistic regression to do classification using MATLAB. There seem to be two different methods in MATLAB's statistics toolbox to build a generalized linear model 'glmfit' and 'fitglm'. I can't figure out what the difference is between the two. Is one preferable over the other?
Here are the links for the function descriptions.
http://uk.mathworks.com/help/stats/glmfit.html
http://uk.mathworks.com/help/stats/fitglm.html
The difference is what the functions output. glmfit just outputs a vector of the regression coefficients (and some other stuff if you ask for it). fitglm outputs a regression object that packs all sorts of information and functionality inside (See the docs on GeneralizedLinearModel class). I would assume the fitglm is intended to replace glmfit.
In addition to Dan's answer, I would like to add the following.
The function fitglm, like newer functions from the statistics toolbox, accepts more flexible inputs than glmfit. For example, you can use a table as the data source, specifyy a formula of the form Y ~ X1 + X2 + ..., and use categorical variables.
As a side note, the function lassoglm uses (depends on) glmfit.

Converting Matlab anonymous functions to Scilab inline functions

Most of my Matlab functions can be converted with the mfile2sci function to Scilab functions except some functions that contain anonymous functions (for example f=#(x,y)sin(x)+log(y)). Is there a way to convert the anonymous functions to Scilab inline functions (for example, for the previous example deff('[z]=f(x,y)','z=sin(x)+log(y)')) so that I don't have to change my Matlab functions?
Yes, in its current state the Matlab to Scilab translator mfile2sci fails to translate anonymous functions, but this behavior can be improved by the following patch:
https://codereview.scilab.org/#/c/20916/
However, be warned that anonymous function occur most of the time when using "solvers" like fsolve, optim, ode solvers (e.g. ode45, ode15s,...), and that statements using these are never translated to working Scilab statements (a warning is given).

How can I call an m file in Simulink and put it to a block in my model?

How can I call an m file in Simulink and put it to a block in my model (without using an S function)? Does anybody have an idea? I'd really appreciate it.
If you're trying to apply a user-defined MATLAB function to Simulink signals, there are a few different ways to do this, depending on your objective. All options are available within the User-Defined Functions section of the Simulink library.
Use the MATLAB function block if you intend to generate code from your model. This block does have restrictions, the entire gamut of built-in MATLAB functions is not available.
Use the Interpreted MATLAB function block if you don't care about code generation, this block can make use of any functions.
Use the Fcn block if your m-file is trivial and contains a simple expression operating on the inputs. In this case you can type the expression directly into the block dialog and reference the input / output signals as shown in the documentation.
MATLAB Fcn block is the best solution to embed M-function file into Simulink model. However, be cautious which version of MATLAB you are using, e.g., with later versions of MATLAB Function Block can be implemented with M-function file with %#codegen and C compiler need to be with your MATLAB package. Good luck