Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
dynare
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Marco Ratto
dynare
Commits
57faed78
Commit
57faed78
authored
7 years ago
by
Stéphane Adjemian
Browse files
Options
Downloads
Patches
Plain Diff
Generalised isfile routine (to accept more than one file name to be tested).
(cherry picked from commit
a83258d4
)
parent
d520b097
No related branches found
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
matlab/utilities/general/isfile.m
+38
-11
38 additions, 11 deletions
matlab/utilities/general/isfile.m
with
38 additions
and
11 deletions
matlab/utilities/general/isfile.m
+
38
−
11
View file @
57faed78
...
...
@@ -27,7 +27,7 @@ function a = isfile(b)
%!
@end
deftypefn
%
@eod
:
%
Copyright
(
C
)
2012
Dynare
Team
%
Copyright
(
C
)
2012
-
2017
Dynare
Team
%
%
This
file
is
part
of
Dynare
.
%
...
...
@@ -44,18 +44,45 @@ function a = isfile(b)
%
You
should
have
received
a
copy
of
the
GNU
General
Public
License
%
along
with
Dynare
.
If
not
,
see
<
http
:
//www.gnu.org/licenses/>.
%
Original
author
:
stephane
DOT
adjemian
AT
univ
DASH
lemans
DOT
fr
stringarrayflag
=
false
;
cellofstringflag
=
false
;
n
=
1
;
a
=
false
;
[
base
,
ext
]
=
strtok
(
b
,
'.'
);
if
isstring
(
b
)
&&
length
(
b
)
>
1
&&
isvector
(
b
)
n
=
length
(
b
);
stringarrayflag
=
true
;
a
=
false
(
size
(
b
));
end
if
is
empty
(
ext
)
%
File
has
no
extension
.
[
status
,
c
]
=
fileattrib
(
b
);
if
status
a
=
~
c
.
directory
;
if
is
cell
(
b
)
&&
length
(
b
)
>
1
&&
isvector
(
b
)
if
all
(
cellfun
(
@ischar
,
b
))
n
=
length
(
b
);
cellofstringflag
=
true
;
a
=
false
(
size
(
b
))
;
else
a
=
0
;
error
(
'
Wrong
input
argument
type
!
'
)
end
end
for
i
=
1
:
n
if
stringarrayflag
d
=
b
(
i
);
elseif
cellofstringflag
d
=
b
{
i
};
elseif
ischar
(
b
)
&&
size
(
b
,
1
)
==
1
d
=
b
;
else
error
(
'
Wrong
input
argument
type
!
'
)
end
[
base
,
ext
]
=
strtok
(
d
,
'.'
);
if
isempty
(
ext
)
%
File
has
no
extension
.
[
status
,
c
]
=
fileattrib
(
d
);
if
status
a
(
i
)
=
~
c
.
directory
;
end
else
a
(
i
)
=
isequal
(
exist
(
d
,
'
file
'
),
2
);
end
else
a
=
isequal
(
exist
(
b
,
'
file
'
),
2
);
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment