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

1 次查看(过去 30 天)
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