Error in path, although it "exists"

10 次查看(过去 30 天)
Claes Olsson
Claes Olsson 2019-1-24
回答: Yash 2025-1-3
Dear Mathworks,
I am running some code that worked fine under r2017a, but now I am on the prerelease 2019a. I want to load a file from a starting directory, that tests OK with "exist", but when I use uigetfile, I get an error message. Any idea? /Claes Olsson
K>> [fNames, fPath, filterNdx] = uigetfile(...
{'*.raw', 'Bruker *.raw v.3'; ...
'*.brml', 'Bruker *.brml'; ...
'*.*', 'All Files'}, ...
'Open *.raw File', ...
'G:\Department\SF\Measurement\SESPC16337\2019\1jan\', 'MultiSelect', 'on');
Error using matlab.ui.internal.dialog.FileSystemChooser/PathParser (line 87)
Invalid directory to operate on
Error in matlab.ui.internal.dialog.FileSystemChooser/set.InitialPathName (line 32)
iPath = PathParser(obj,iPath);
Error in uigetputfile_helper (line 52)
ufd.InitialPathName = dialog_pathname;
Error in uigetfile (line 130)
[filename, pathname, filterindex] = uigetputfile_helper(0, varargin{:});
K>> exist('G:\Department\SF\Measurement\SESPC16337\2019\1jan\')
ans =
7
K>> ver
-----------------------------------------------------------------------------------------------------
MATLAB Version: 9.6.0.1011450 (R2019a) Prerelease
MATLAB License Number: Prerelease
Operating System: Microsoft Windows 10 Enterprise Version 10.0 (Build 17134)
Java Version: Java 1.8.0_181-b13 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
-----------------------------------------------------------------------------------------------------
MATLAB Version 9.6 (R2019a)
Image Processing Toolbox Version 11.0 (R2019a)
MATLAB Compiler Version 7.0.1 (R2019a)
Optimization Toolbox Version 8.3 (R2019a)
  4 个评论
Jan
Jan 2022-12-18
But why was the question raised now?
Steven Lord
Steven Lord 2022-12-18
My guess is that someone posted a spam answer or comment (which made this question one of the "Most recently updated" items) and then that spam was deleted.

请先登录,再进行评论。

回答(1 个)

Yash
Yash 2025-1-3
Hi Claes,
This works perfectly fine in the final release of MATLAB R2019a. However, I found one mistake in the code shared, the extensions to filter the files should be separated by semi-colon instead of a comma. Given below is the updated code:
[fNames, fPath, filterNdx] = uigetfile(...
{'*.raw'; 'Bruker *.raw v.3'; ...
'*.brml'; 'Bruker *.brml'; ...
'*.*'; 'All Files'}, ...
'Open *.raw File', ...
'G:\Department\SF\Measurement\SESPC16337\2019\1jan\', 'MultiSelect', 'on');
If the issue persists for you, please contact MathWorks Technical Support at: https://www.mathworks.com/support/contact_us.html

类别

Help CenterFile Exchange 中查找有关 MATLAB Compiler 的更多信息

标签

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by