how to load graphs on to GUI from other mat file?
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
Rik
2019 年 5 月 28 日
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.
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Migrate GUIDE Apps についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!