필터 지우기
필터 지우기

pass the last Element off array to GUI

조회 수: 1 (최근 30일)
Jay Samin
Jay Samin 2016년 8월 12일
댓글: Jay Samin 2016년 8월 15일
I have an issue with MATLAB GUIs that I don't know how to solve. i want to pass the last Element off array to GUi, i have tried using this code but its doesnt work
% --- Executes on button press in Aufruf_Reichweintschaetzer.
function Aufruf_Reichweintschaetzer_Callback(hObject, eventdata, handles)
% hObject handle to Aufruf_Reichweintschaetzer (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles=guidata(hObject);
a=required_energy(end); % last element of my array required_energy already exists in my workspace
set(handels.edit7, 'string',a);
guidata(hObject,handles);
i will apreciate any Help many thanks Jay
  댓글 수: 2
Geoff Hayes
Geoff Hayes 2016년 8월 12일
Jay - why is the required_energy variable defined in your workspace and not within the GUI? Where does it come from?
Jay Samin
Jay Samin 2016년 8월 13일
Hi Geoff,
Thanks for your quick reply, the variable "required_energy "will be sent to the Workspace after i run my Simulink-model.

댓글을 달려면 로그인하십시오.

채택된 답변

Geoff Hayes
Geoff Hayes 2016년 8월 13일
Jay - since the Simulink model sends the requried_energy variable to the workspace, then consider using evalin from within your GUI to access it. You can try
function Aufruf_Reichweintschaetzer_Callback(hObject, eventdata, handles)
a = evalin('base','required_energy(end)');
% etc.
to extract the last element from this array.
  댓글 수: 2
Jay Samin
Jay Samin 2016년 8월 15일
Heey Geoff,
thank you, it works
Jay Samin
Jay Samin 2016년 8월 15일
Hey Geoff,
I have a general question, do u know if there is a ready-made list of programming structures and commands ?
I mean, not this PDF Introduction, which are found all the time in Internet, but rather a list, in which I can find useful commands, such varargin or Evalin and ect..
Thanks in advance

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by