フィルターのクリア

Error with uigetfile in an Application

17 ビュー (過去 30 日間)
FRANCESCO MARINO
FRANCESCO MARINO 2021 年 2 月 1 日
コメント済み: FRANCESCO MARINO 2021 年 2 月 2 日
Hey There!
I'm a newbie in this forum but I've been using it for a while and it solved a lot of issues I had to fix.
I've designed a UI interface were I had to press a button which made me import a .s2p file and then plot it.
Anyway, I had an issue since it gave me this error:
"Error using rf.file.touchstone.Data/read
Unable to open file 433_26_6.s2p."
I see this error message on the first time I load the file from a different folder than the one of the App.
Then it doesn't occurr....
I'm leaving you the code:
file = uigetfile({'*.s2p; *.s1p','TouchStone Files (.s2p, .s1p)'},'File Selector');
s = sparameters(file)
y = yparameters(file)
figure
rfplot(s, 'real')
figure
rfplot(s, 'imag');
"
Thank You in Advance
  2 件のコメント
Daniel Catton
Daniel Catton 2021 年 2 月 1 日
編集済み: Daniel Catton 2021 年 2 月 1 日
I believe that UIGetfile just gets the name of the file that you select, thus you will need to have a line of code just after UIGetfile which says:
file = load(file)
FRANCESCO MARINO
FRANCESCO MARINO 2021 年 2 月 2 日
That's what I was looking for!
Thank You very much!

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

採用された回答

Jan
Jan 2021 年 2 月 2 日
If you select a different folder in the UIGETFILE dialog, this is not inlcuded in the 1st output, but in the 2nd one:
[fileName, filePath] = uigetfile( ...
{'*.s2p; *.s1p','TouchStone Files (.s2p, .s1p)'}, ...
'File Selector');
if ~ischar(fileName)
disp('User has canceled the file selection');
return;
end
file = fullfile(filePath, fileName);
Now this is the complete file name including the path.
  1 件のコメント
FRANCESCO MARINO
FRANCESCO MARINO 2021 年 2 月 2 日
Thank You very Much!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by