How do I add a table in GUIDE
    3 ビュー (過去 30 日間)
  
       古いコメントを表示
    
I'm trying to add a table to my GUI in guide. This is my first GUI and I'm really confused how I load data into a GUI table. I understand how the uitable command works from the workspace window, or through scripts/functions, but I don't have the slightest clue of where I need to add my snippet of code that makes the table into my GUI. I'm not trying to have users input data, all I need to do is load in lists of names after clicking a button. Sorry this question is so basic, I just can't figure out where I need to add this in my code.
0 件のコメント
採用された回答
  Geoff Hayes
      
      
 2014 年 11 月 16 日
        Joseph - you would add your "load table" code in the callback function of your push button. If you are using GUIDE to create your GUI, suppose that your pushbutton is named/tagged as btnLoadData and your table is named/tagged as tblOfData. Then the push button callback is
 function btnLoadData_Callback(hObject, eventdata, handles)
 % hObject    handle to btnLoadData (see GCBO)
 % eventdata  reserved - to be defined in a future version of MATLAB
 % handles    structure with handles and user data (see GUIDATA) 
 % create a matrix of random data to load into the table
 dataToLoad = randi(255,9,4);
 % update the table with the data
 set(handles.tblOfData,'Data',dataToLoad);
And that is it, with the only difference being how you retrieve the data to load into your table.
0 件のコメント
その他の回答 (1 件)
  Jan
      
      
 2014 年 11 月 16 日
        If you need the action to happen, when a button is clicked, the corresponding code belongs to the butoon's callback function.
0 件のコメント
参考
カテゴリ
				Help Center および File Exchange で Interactive Control and Callbacks についてさらに検索
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


