read and display data from cell array to static box of GUI

1 view (last 30 days)
% --- Executes on button press in Get_Detail.
function Get_Detail_Callback(hObject, eventdata, handles)
% hObject handle to Get_Detail (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
load('stu.mat')
set(handles.text5,'string',['deatail=','stu{1,1}']);
this is the code of my button get_detail. I want that when I push it then cell array named Stu.mat is load and then a particular detail is display on statis box of GUI named text5 from my cell array.

Answers (1)

Geoff Hayes
Geoff Hayes on 1 Mar 2015
Mohammad - you need to remove the single quotes from around your call to get the first of element of stu else the code will just treat this command as a string. Your set then becomes
set(handles.text5,'string',['deatail=',stu{1,1}]);
  2 Comments
Mohammad Ayyub Khan
Mohammad Ayyub Khan on 1 Mar 2015
Edited: Geoff Hayes on 1 Mar 2015
yeah sir i also tried this but the error is
??? Reference to non-existent field 'text1'.
Error in ==> Recognizer>Get_Detail_Callback at 210
set(handles.text1,'string',['name=',stu{1,1}]);
Error in ==> gui_mainfcn at 96
feval(varargin{:});
Error in ==> Recognizer at 42
gui_mainfcn(gui_State, varargin{:});
Error in ==>
@(hObject,eventdata)Recognizer('Get_Detail_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol Callback
>>
and some it says undefined variable 'stu'
Geoff Hayes
Geoff Hayes on 1 Mar 2015
Mohammad - the code that I modified is based on yours which does not reference a field named text1 but text5.
As for the undefined variable stu, did you load the stu.mat file? Perhaps you need to provide the full path to the file.
If you are going to post an error message like the above, then you need to provide the code that generates the error.

Sign in to comment.

Categories

Find more on Graphics Performance in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!