});

Matlab Skills

Partialy load and save .mat file

Matlab is RAM-greedy.
Can load/write .mat files partially to mitigate it.
{Matlab-doc}
Quick start

To load and partially with regular expression:

Note that MatLab has 2 ways to call functions:

{Ref-Mathwork}

Renew saved figure files

retrieve data from matlab figure file for new plot.
For python user, matlab plot functions are almost the same as matplotlib, except no prefix like plt.* needed.
Ref: https://www.mathworks.com/matlabcentral/answers/100687-how-do-i-extract-data-from-matlab-figures

The interactive notebook (.mlx file) is extremely handy for development. It can convert the block into local function, increase the recallability of the code blocks. Here shows a local function for retrieve the data in figure file and replot them in new layout.

Basic

data structure

  • {, } for cell array, analogous to python list
  • [,] for array
  • (,) for indices

Variables general info

Use whos, can combine it with -regexp. {Link}

batch run matlab

Introduce a unix command: xargs
It will convert the stdin to stdout.
See detailed Chinese introduction in Here

So option:

  1. -p get permission for each run
  2. -n2 output 2 each batch
  3. -I {} will replace with the output
  4. -P 2 for parallel with 2 threads, but better use with -n1 to pass the task one by one

batch downloading:

where the url.txt is like

But now for simplicity, I just input the dropbox link without ?dl=0 in a txt file and run:

where -q is quiet wget, otherwise wget output will jam the window, -n1 is output one by one and -P2 is parallel with 2 threads

Use matlab in Terminal

The command is

Only run script and record all output as log

Note: matlab for loop has poor compatibility with global variables. Maybe while loop is better.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.