MATLAB Answers

how to save xcel file in two coloum in matlab using xlswrite

1 view (last 30 days)
Rohit Bhoi
Rohit Bhoi on 22 Jan 2016
Answered: Geoff Hayes on 22 Jan 2016
I have GUI form and I in which there are 12 text box and 12 edit box. I want save this form using in excel format. first column should be all text boxes and second column should all edit box value. I obtained value using get(handle.tex) and get(handle.edit) value but enable to save. so have can I save this using xlswrite

Accepted Answer

Geoff Hayes
Geoff Hayes on 22 Jan 2016
Rohit - what can you tell us about the data in the text and edit fields? Are they numeric or do they contain characters? If a combination of the two, you may want to create a 12x2 cell array where each element from the first column corresponds to one of the text boxes, and each element in the second column corresponds to one of the edit boxes. Something like the following should do
data = cell(12,2);
data{1,1} = char(get(handle.text1,'String')); % convert to number if needed with str2double
data{2,1} = char(get(handle.text2,'String'));
% etc.
data{1,2} = char(get(handles.edit1,'String'));
% etc.
Then use xlswrite to save to file
myFilename = 'myExcelFile.xls';
xlswrite(myFileName,data);
Try the above and see what happens!

More Answers (0)

Community Treasure Hunt

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

Start Hunting!