exporting listbox to excel while adding spaces in between variable names
古いコメントを表示
Good Morning All,
I have created a GUI which uses a listbox of some parameter names. I am looking to export the parameters chosen as column heads of an excel spreadsheet, however I want to know how to add a blank column in between each selected parameter.
I know how to obtain the Names and Index of the listbox by:
Variable_Name = get(handles.Parameter_Listbox,'String');
Index = get(handles.Parameter_Listbox,'Value');
Now to create a space between the names I thought I could use a loop to build a matrix and tried the following:
for i=1:length(Index)
OutputTitles(i)=[Variable_Name(Index), ' '];
end
Then I could just use xlswrite(Output_File,OutputTitles,Sheet1,Range1);
I was also wondering if anyone could tell me how to skip more than one column header too. Say I wanted to put the Parameter Name every 5th column instead.
Thanks so much,
Mel
採用された回答
その他の回答 (1 件)
Iain
2014 年 8 月 19 日
Its playing with cell arrays:
Variable_Name = {'One','Two','Many'};
chosen_variable_names = Variable_Name(index);
Output_Table{1,1} = chosen_variable_names{1}; % column 1
Output_Table{1,3} = chosen_variable_names{2}; % column 3
Output_Table{1,45} = chosen_variable_names{3}; % column 45
カテゴリ
ヘルプ センター および File Exchange で Spreadsheets についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!