Commit 1ce2eec1 authored by Lukas Aspöck's avatar Lukas Aspöck

adjusted readAc3DModelFile: ac3d file read / import compatible to newer matlab verions (>2016b)

parent d6f6a2b1
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment