Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dynare
dynare
Commits
ffa281a0
Commit
ffa281a0
authored
9 years ago
by
Stéphane Adjemian
Browse files
Options
Downloads
Plain Diff
Merge pull request #1043 from JohannesPfeifer/check_matlab_path
Make check_matlab_path.m able to deal with one-letter files
parents
ae49cddd
14e2b6ec
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
matlab/check_matlab_path.m
+18
-26
18 additions, 26 deletions
matlab/check_matlab_path.m
with
18 additions
and
26 deletions
matlab/check_matlab_path.m
+
18
−
26
View file @
ffa281a0
...
@@ -117,34 +117,26 @@ function flist = getallroutinenames(p, excludedsubfolders)
...
@@ -117,34 +117,26 @@ function flist = getallroutinenames(p, excludedsubfolders)
if
nargin
<
2
if
nargin
<
2
excludedsubfolders
=
{};
excludedsubfolders
=
{};
end
end
dd
=
dir
(
p
);
flist
=
{};
flist
=
{};
for
f
=
1
:
length
(
dd
)
%get m-files in this directory
if
~
(
isequal
(
dd
(
f
)
.
name
,
'.'
)
||
isequal
(
dd
(
f
)
.
name
,
'..'
))
dd
=
dir
([
p
,
filesep
'*.m'
]);
if
dd
(
f
)
.
isdir
temp
=
struct2cell
(
dd
);
if
~
ismember
(
dd
(
f
)
.
name
,
excludedsubfolders
)
flist
=
[
flist
temp
(
1
,:)];
r
=
getallroutinenames
([
p
filesep
dd
(
f
)
.
name
]);
%deal with subdirectories
flist
=
{
flist
{:}
r
{:}
};
dlist
=
getalldirectories
(
p
,
excludedsubfolders
);
%first call with excluded directories
end
for
ii
=
1
:
length
(
dlist
)
else
flist
=
[
flist
getallroutinenames
([
p
filesep
dlist
{
ii
}])];
%recursive calls without subfolders
% Filter out files without m extension.
if
isequal
(
dd
(
f
)
.
name
(
end
-
1
:
end
),
'.m'
)
flist
{
length
(
flist
)
+
1
}
=
[
dd
(
f
)
.
name
];
end
end
end
end
end
function
dlist
=
getalldirectories
(
p
)
dd
=
dir
(
p
);
function
dlist
=
getalldirectories
(
p
,
excluded_directories
)
dlist
=
{};
if
nargin
<
2
for
f
=
1
:
length
(
dd
)
excluded_directories
=
{};
if
~
(
isequal
(
dd
(
f
)
.
name
,
'.'
)
||
isequal
(
dd
(
f
)
.
name
,
'..'
))
if
dd
(
f
)
.
isdir
dlist
{
length
(
dlist
)
+
1
}
=
[
dd
(
f
)
.
name
];
end
end
end
end
dd
=
dir
(
p
);
dir_result
=
struct2cell
(
dd
);
directory_indicator
=
cell2mat
(
dir_result
(
4
,:));
dlist
=
dir_result
(
1
,
directory_indicator
==
1
&
~
strcmp
(
'.'
,
dir_result
(
1
,:))
&
~
strcmp
(
'..'
,
dir_result
(
1
,:))
&
~
ismember
(
dir_result
(
1
,:),
excluded_directories
));
function
n
=
position
(
i
,
currentpath
)
function
n
=
position
(
i
,
currentpath
)
n
=
length
(
strfind
(
currentpath
(
1
:
i
),
pathsep
));
n
=
length
(
strfind
(
currentpath
(
1
:
i
),
pathsep
));
\ 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