MATLAB: How to save data of UITABLE in Workspace

uitable

Hi,
I have a uitable with 3-columns of which first two are fixed, while the 3rd columns receives input from the user. Now I want to save this new data to somewhere like – workspace/excel file/ mat file. I have following code ==
load data.mat columns={'x','y','z'}; ht = uitable(uitable(data,columns,'Position',[25 90 200 200])); newdata =get(h,'Data'); FileName = uiputfile('*.xls','Save as'); xlswrite(FileName,newdata),
Whenever I run this above matlab gives following error, I can't find solution for this. So any suggestion will be heartly appreciated.
In uitable at 46 In new at 7 Error using horzcat The following error occurred converting from char to opaque: Error using horzcat Undefined function 'opaque' for input arguments of type 'char'.
Error in uitable_deprecated (line 40)
Error in uitable (line 47) [thandle, chandle] = uitable_deprecated(varargin{:});
Error in new (line 7) ht = uitable(uitable(data,columns,'Position',[25 90 200 200]));
Kindly help me out. Thank you.

Best Answer

I think you are using uitable wrong. Look at the documentation for this function but I believe it should be something like this:
ht = uitable('Data',data','ColumnName',columns,'Position',[25 90 200 200]);
and then
newdata = get(ht,'Data');