how to make all cells in uitable editable in matlab GUI and save them when i press pushbutton ? how to read all contents from xlsread array

7 views (last 30 days)
I have GUI which has uitable. I want to read data into table and display when I select options in the listbox ... The GUI also has two push buttons edit and save to enable edit and save after I make changes I am using xlsread to read data into array. however, for some reason, it reads all the cells but not the first two rows of excel file which has text

Accepted Answer

Walter Roberson
Walter Roberson on 23 Jun 2018
[~, ~, raw] = xlsread('YourFile.xls');
Now raw will contain headers and all.
h = uitable('data', raw, 'ColumEditable', true(1, size(raw,2)));
  5 Comments
VBBV
VBBV on 23 Jun 2018
Ok, I got it now ...
but how do I write the data contents to specific cell/s of uitable after I read it using xlsread
Walter Roberson
Walter Roberson on 23 Jun 2018
It is not possible to directly write to specific cells of a uitable. All you can do is create a numeric array (if your data is pure numbers) or cell array (if you have some non-numeric entries) and put things where you want in that array, and then set the resulting array as the Data property of the uipanel.
uitable is not a spreadsheet; you cannot address parts of it, and there are no macros, and it is not very flexible about formatting.

Sign in to comment.

More Answers (0)

Categories

Find more on Migrate GUIDE Apps 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!