Real time plots in matlab standalone application - matlab

The application is a GUI designed with GUIDE with lots of subplots that have an refresh interval approx ~1s adding new data to the time series, for example:
I have read through making-graphs-responsive-with-data-linking, but the efficient linkdata on does not work in standalone applications when exporting with application compiler:
Error using linkdata (line 24)
Plots cannot be linked in deployed applications because linked plots require the MATLAB workspace.
,while refreshdata works but results in heavy load.
What is the efficient way to plot data in real-time, is it still like gnovice suggests here and does this work for standalone's (lacking the workspace) efficiently too?
I also noticed animatedline doc, but dunno
machine: debian 9 x64

Related

X11 MATLAB Display Figure

I know it's possible to forward any output from a remote machine to a local one by using the X11 forwarding remote tunnelling, so that when you run a MATLAB command it will display all the graphical outputs back to the machine you've connected from.
My question is:
Is there any MATLAB command to just output the figures (e.g., plot,surf,etc.) without displaying any other graphical object (i.e., the main interface)?
In practice, I would like to interact with MATLAB by using the command line (as shown below) and forward back only the figures.
MATLAB cannot display figures without its own figure-GUI, so the answer to your question would be no.
However: there is a workaround: create an invisible figure using f=figure('visible', 'off'), then plot your data, and finally use saveas(f,filename,fileextention). Don't forget to close(f) your figure after saving, to free the RAM. You'll now have a figure in your file directory, which you can display using your favourite visualising tool, which might even be possible through a call to system, although I have never tested that.

matlab osm webread slow

i am using Matlab's webread() function to download openstreetmap osm files.
My goal is to write an application that downloads osm data, parses it in Matlab, then reads out coordinate values and plots them.
Unfortunately, the overall code seems to run pretty slow, and running the profiler showed that most of the runtime comes from using the webread() function, even though the requested .osm are comparatively small (<500kb) and downloaded via Browser within a fraction of the time the function uses.
What can i do to speed up the downloading process? Is it recommended to use the webread function for this task at all? I was also considering downloading the files by using another language/a bash application that can be called from within Matlab.
EDIT: osm data is downloaded as XML file

Does Matlab R2015 use GPU?

Mathworks seems to be working on making better use of GPUs and I am wondering at what stage they are at in R2015. Does it automatically use GPU or do I need to program Matlab somehow to make use of my GPU? I have Nvidia GTX860M and it would be a pity for it to idle away while I sit and wait for Matlab to execute scripts. Do I still need to get an add-on for GPU for Matlab R2015?
If someone is currently using GPU in their Matlab computing, can you post some relevant links with what I have to go to set it up (preferably for R2015, if it makes any difference)? Whenever I search I come across different instructions made for Matlab from R2006 to R2012 and I wonder if they are still relevant for more recent releases.
Does it automatically use GPU?
No, you have to make the decision. Using the gpuArray function you decide to copy the data to the graphic card memory. Any data stored there is processed by the gpu (as long as the function is supported, otherwise you get an error), any data stored in your main memory is processed by the CPU.
For more information how to use it, start reading here http://de.mathworks.com/discovery/matlab-gpu.html

Spawn multiple copies of matlab on the same machine

I am facing a huge problem. I built a complex C application with embedded Matlab functions that I call using the Matlab engine (engOpen() and such ...). The following happens:
I spawn multiple instances of this application on a machine, one for each core
However! ... The application then slows down to a halt. In fact, on my 16-core machine, the application slows down approximately by factor 16.
Now I realized this is because there is only a sngle matlab engine started per machine and all my 16 instances share the same copy of matlab!
I tried to replicate this with the matlab GUI and its the same problem. I run a program in the GUI that takes 14 seconds, and THEN I run it in two GUIs at the same time and it takes 28 seconds
This is a huge problem for me, because I will miss my deadline if I have to reprogram my entire c application without matlab. I know that matlab has commands for parallel programming, but my matlab calls are embedded in the C application and I want to run multiple instances of the C application. Again, I cannot refactor my entire c application because I will miss the deadline.
Can anyone please let me know if there is a solution for this (e.g. really start multiple matlab processes on the same machine). I am willing to pay for extra licenses. I currently have fully lincensed matlab installed on all machines.
Thank you so so much!
EDIT
Thank you Ben Voigt for your help. I found that a single instance of Matlab is already using multiple cores. In fact, running one instance shows me full utilization of 4 cores. If I run two copies of Matlab, I get full utilization of 8 cores. Hence it is actually running in parallel. However, even though 2 instances seem to take up double the processing power, I still get 2* slowdown. Hence, 2 instances seem to get twice the result with 4* the compute power total. Why could that be?
Your slowdown is not caused by stuffing all N instances into a single MatLab instance on a single core, but by the fact that there are no longer 16 cores at the disposal of each instance. Many MATLAB vector operations use parallel computation even without explicit parallel constructs, so more than one core per instance is needed for optimal efficiency.
MATLAB libraries are not thread-safe. If you create multithreaded applications, make sure only one thread accesses the engine application.
I think the matlab engine is the wrong technique. For windows platforms, you can try using the com automation server, which has the .Single option which starts one matlab instance for each com client you open.
Alternatives are:
Generate C++ code for the functions.
Create a .NET library. (NE Builder)
Run matlab via command line.

Combined XY realtime plots

Ok so there was confusion on what i was asking. I need help adjusting the algorithm I already have here. First part I need the X axis to be time and Y axis to be data read from file the user specifies the directory. This data file will be written every second so the graph should pause or graph 0 if there is no data and time is still running. The purpose of this program is that a script in linux will write to a file cpu, memory and power consumption and I have to graph that.
You can add multiple TimeSeries to a TimeSeriesCollection, as shown here.