how to load graphs on to GUI from other mat file?
1 view (last 30 days)
Show older comments
As part of my GUI I need to load a two graphs that were generated from the mat file to the axes. I have written the following code but this is yeilding errors.
function pushbutton1_Callback(hObject, eventdata, handles)
X = main_file_Run(handles) %X= main_file_Run(handles)
set(handles.pushbutton1,'string','Processing...');
pause(0.01);
handles.text5.String = num2str(X(2));
axes(handles.axes1)= @plot_statistics;
m1 =1;
m2=671+m1;
t1=1:1:672;
plot(t1,load1(m1:m2).*(15/60),'DisplayName','Load','LineStyle','--')
hold
plot(t1,temp(1:672),'DisplayName','Total PV Generation')
ylabel('{\it E} in kWh','FontName','Times','FontName','Times','FontSize',12);
xlabel('{\it t} in hours','FontName','Times','FontSize',12);
axes(handles.axes2);
plot(1:1:672,Ev(m1:m2)*100/Evmax,'DisplayName','Ev SOC')
ylabel('SOC in %','FontName','Times','FontSize',12);
xlabel('{\it t} in hours','FontName','Times','FontSize',12);
set(handles.pushbutton1,'string','optimize');
I have attached a matlab file from which i looked to extract data. Any advise is appreciated.
*NOTE : I do not want to disturb the graphs generated by MATFILE except i want to use the data from the matfile and generate two extra graphs onto axes on GUI created.
Thanks in advance.
4 Comments
Rik
on 28 May 2019
There is a big difference between a mat file and an m file. One contains data, the other code.
But for you problem: as long as you can generate the graphs, you can extract the data fairly easily with the XData and YData properties of the axes children. Then you can replot the data inside your GUI. If you need to, I could probably write a proof of principle, but I won't be doing so today, nor probably with your data.
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!