Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
Institute of Technical Acoustics (ITA)
toolbox
Commits
1ce2eec1
Commit
1ce2eec1
authored
Sep 01, 2017
by
Lukas Aspöck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adjusted readAc3DModelFile: ac3d file read / import compatible to newer matlab verions (>2016b)
parent
d6f6a2b1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
6 deletions
+26
-6
applications/VirtualAcoustics/Raven/load_ac3d.m
applications/VirtualAcoustics/Raven/load_ac3d.m
+26
-6
No files found.
applications/VirtualAcoustics/Raven/load_ac3d.m
View file @
1ce2eec1
...
...
@@ -33,17 +33,37 @@ classdef load_ac3d
% OTHER FUNCTIONS
function
obj
=
readAc3DModelFile
(
obj
,
fullFilename
)
% new read method for loading ac3d file
% (works also with Matlab 2016 and newer)
if
exist
(
fullFilename
,
'file'
)
% ac3d_import = importdata(fullfile(pwd, fullFilename));
ac3d_import
=
importdata
(
fullFilename
);
obj
.
modelFilename
=
fullFilename
;
fileID
=
fopen
(
fullFilename
);
allRows
=
textscan
(
fileID
,
'%s'
,
'Delimiter'
,
'\n'
);
maxLengthRow
=
0
;
for
iRows
=
1
:
length
(
allRows
{
1
})
if
(
~
isempty
(
allRows
{
1
}{
iRows
}))
currentLine
=
textscan
(
allRows
{
1
}{
iRows
},
'%s'
,
'Delimiter'
,
' '
);
if
length
(
currentLine
{
1
})
>
maxLengthRow
maxLengthRow
=
length
(
currentLine
{
1
});
end
end
end
ac3d
=
cell
(
length
(
allRows
{
1
}),
maxLengthRow
);
for
iRows
=
1
:
length
(
allRows
{
1
})
if
(
~
isempty
(
allRows
{
1
}{
iRows
}))
currentLine
=
textscan
(
allRows
{
1
}{
iRows
},
'%s'
,
'Delimiter'
,
' '
);
ac3d
(
iRows
,
1
:
length
(
currentLine
{
1
}))
=
currentLine
{
1
}
'
;
end
end
fclose
(
fileID
);
else
error
(
'The specified file does not exist!'
);
end
ac3d
=
ac3d_import
.
textdata
;
% nur textdata von "importdata" interessant
% Materialnamen und Farben
mat_rows
=
find
(
strcmp
(
ac3d
,
'MATERIAL'
)
==
1
);
% Zeilenindizes der Materialien
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment