【发布时间】:2015-09-18 00:10:33
【问题描述】:
我希望能够使用 MATLAB 从工作区中的每个名称中导出值。
我有一些问题,然后在工作区中设置变量。我试过xlswrite,但无法导出文件。我认为它不会只导出我希望它执行的值。
% Construct a questdlg with three options
choiceprepq = 'Which animal do you like?';
choiceprep = questdlg('Which animal do you like?', 'Which animal do you like?', 'Dog', 'Cat','Fish');
% Handle response
switch choiceprep
case 'Dog'
disp([choiceprep ' Dog Selected.'])
case 'Cat'
disp([choiceprep ' Cat Selected.'])
case 'Fish'
disp([choiceprep ' Fish Selected.'])
end
alldata= whos('global');
filename='Test.xls';
xlswrite(filename,alldata)
有没有办法将用户从问题框中选择的问题和值导出为 Excel 文件?不是变量的名称choiceprep,而是它的值。
【问题讨论】: