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!