switch-case interaction with uigetfile

The following code seems straightforward. But the dialog box showing the files only appears briefly. It seems to be a condition associated with the switch-case construction because uigetfile works o.k. in testg.m outside of the switch-case.
The same action happened with uiopen.
Suggestion for a cure?
function [ ] = testg()
menu_choice = menu('Design Tools', 'Set Up Design File', 'Vehicle Aerodynamics');
switch menu_choice
case 1
[FileName, PathName] = uigetfile('*.mat');
case 2
disp('Aero!');
end

1 件のコメント

Eric
Eric 2011 年 3 月 7 日
Oleg,
That is the whole code for testg.m. It was extracted from a larger function called design_tools.m.

サインインしてコメントする。

回答 (2 件)

Paulo Silva
Paulo Silva 2011 年 3 月 6 日

0 投票

Your code is working without any problems in matlab 2008b.

4 件のコメント

Eric
Eric 2011 年 3 月 6 日
Paulo,
Thanks for checking the code in 2008b. Your result caused me to run testg.m in 2010a (which is as far back as I go). The problem occurs there, too. This suggests there is a bug in 2010b (and "a"). Do you agree?
Eric
Eric 2011 年 3 月 6 日
I should add that when I run the code in the workspace it works.
Paulo Silva
Paulo Silva 2011 年 3 月 6 日
Might be many things, please wait until more people test it.
Oleg Komarov
Oleg Komarov 2011 年 3 月 6 日
Is that the whole code you have in the function?

サインインしてコメントする。

Walter Roberson
Walter Roberson 2011 年 3 月 7 日

0 投票

Put a breakpoint in menu() and experiment to see what is going on.

カテゴリ

ヘルプ センター および File ExchangeApp Building についてさらに検索

質問済み:

2011 年 3 月 6 日

Community Treasure Hunt

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

Start Hunting!

Translated by