How to add data to a GUI table that was loaded from a file?

조회 수: 1 (최근 30일)
Flávio
Flávio 2013년 2월 9일
So, I was able to create an option that allows user to load data from a specified file (listdlg with list of files) and present it in GUI table. I did it by putting: set(handles.uitable1,'Data',specifiedFile) in pushbutton callback.
The thing is, now I have the loaded data and the remaining spaces in blank (I set the GUI table with 500 lines).
Now I want to new data, but the remaining spaces don't hold the values that I introduce. They just go blank again after I add values.
How can I fix this?
Sorry for my bad English.
Thanks!
  댓글 수: 5
Jan
Jan 2013년 2월 11일
I still do not understand, what the problem is. Perhaps it helps, when you post some code. Omit unecessary details like the loading, but use RAND() to concentrate on the problem.
"The values added don't hold" is not helpful. How have you added the data and what causes them to vanish? We cannot guess what's going on.
Flávio
Flávio 2013년 2월 11일
I can't separate the loading from the vanishing values, because I think they are related!
In the load button callback I wrote: set(handles.uitable1,'Data',loaded_variable)
Uitable1 is a GUI table that I created in GUI mode. The values added are editable.
I don't know how to explain this in a different way...
I just used the 'set' to load data from a variable, and then I want to add data in the table, the cells from table are editable... The Gui table has 500 rows and 2 columns right? So imagine a variable 'test' with 2 rows and 2 colums, say test=[1 2;3 4] right?
So when I run GUI, I click the load button and choose variable 'test'. The data will appear in table. So now I have 498 rows in blank, editable cells right? I want to add data in those cells. The thing is, when I write a value in one of these cells and click enter, the cell just go blank again!
All I did was to use the 'set' function to load a variable to table!
Did you understand me now? Sorry for my bad English, I really don't know how to explain better!
Thanks ;)

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

채택된 답변

Jan
Jan 2013년 2월 11일
Replacing the ortiginal Data seems to be a bad idea. What about inserting the new values?
Data = cell(20, 2);
h = uitable('Data', Data);
...
newData = {rand, rand; rand, rand};
Data = get(h, 'Data');
Data(1:size(newData, 1), :) = newData;
set(h, 'Data', Data);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Specifying Target for Graphics Output에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by