Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Accessing array in Compiled MATLAB program, is it possible?

2 visualizaciones (últimos 30 días)
Freddy
Freddy el 17 de Jun. de 2014
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
Hello folks,
I have a MATLAB MCR program which performs a variety of calculations then displays the final results in a graph which I can zoom into and read off the results. I need to put the results in a table, and I am having to do it by hand. This is hugely frustrating as it takes a lot of time when it could be simply be outputted as a table.
I do not have access to the source code, so changing it that way is not an option, I just wondered if there is a way of accessing any arrays containing the results while the program is running? I'm open to any ideas just don't want to keep doing via this method! Please Help!
Thanks x

Respuestas (1)

Mukul Rao
Mukul Rao el 14 de Jul. de 2014
Hi,
The extracted files pertaining to an application (.exe) contain encrypted MATLAB files. You can locate this directory using the MATLAB command "mcrcachedir". Since they are encrypted, there is no way you would be able to reverse engineer or alter information in these files.
However, if you have access to MATLAB, then extracting information from plots generated by MATLAB standalone applications is certainly possible by obtaining the figure handle and extracting data from the plots.
Here is a simple example using which I was able to verify that this was possible. I made a simple application (.exe), the source code for which does the following:
>> x=1:10;
>> y=1:10;
>> plot(x,y); %Plots a straight line
When I ran the application, the app generated a figure which I was able to save as a “.fig” file. I then loaded this figure into MATLAB using the command:
>> figure_handle = hgload(myfig.fig); %Extract the figure handle
I then extracted the Xdata and Ydata from the plot as follows:
>> axes_handle = gca ; %Get current axes handle
>> plot_handle = get(axes_handle,Children) %Get plot handle
>> Xdata = get(plot_handle,Xdata);
>> Ydata = get(plot_handle,Ydata);
Please refer the link below that demonstrates how to work with MATLAB figures from the command prompt. This should help you work with the figure data and extract information you deem to be useful.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by