User Tools

Site Tools


visual3d:documentation:third-party:matlab:matlab_read_v3d_text

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
visual3d:documentation:third-party:matlab:matlab_read_v3d_text [2024/07/16 17:02] – removed sgrangervisual3d:documentation:third-party:matlab:matlab_read_v3d_text [2024/07/17 15:46] (current) – created sgranger
Line 1: Line 1:
 +====== Matlab Read V3D Text ======
 +
 +The following sample code can be used to read a [[Visual3D:Documentation:Pipeline:File_Commands:Export_Data_To_ASCII_File|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 ====
 +
 +<code>
 +% ---------------------------------------------------
 +% 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;
 +</code>
 +
 +
  
visual3d/documentation/third-party/matlab/matlab_read_v3d_text.1721149355.txt.gz · Last modified: 2024/07/16 17:02 by sgranger