User Tools

Site Tools


visual3d:documentation:third-party:matlab:matlab_read_v3d_text

Matlab Read V3D Text

The following sample code can be used to read a text file exported from Visual3D into Matlab.

This assumes the user exported the headers. The numerical values are stored in numericData and the headers are stored in headerData.

Exmaple

% ---------------------------------------------------
% Read Visual3D Text File
% ---------------------------------------------------

filename = 'C:\Users\Documents\Support\Test.txt';

numericData = dlmread(filename,'\t',5,1);

[ rows , columns ] = size(numericData);
headerCount = ( columns + 1 )* 5; 

fileID = fopen(filename);
importHeaders = textscan(fileID,'%s',headerCount,'Delimiter','\t');
fclose(fileID);

clearvars filename fileID;

headerData = cell(5,columns);
start=2; 
for i=1:5
    stop= (start + columns) - 1;
    headerData(i,:) = transpose(importHeaders{1,1}(start:stop));
    start = stop+2;
end

clearvars rows columns start stop i headerCount importHeaders;
visual3d/documentation/third-party/matlab/matlab_read_v3d_text.txt · Last modified: 2024/07/17 11:46 by sgranger