加快PLY文件的读取速度

您所在的位置:网站首页 matlabdlmread 加快PLY文件的读取速度

加快PLY文件的读取速度

#加快PLY文件的读取速度| 来源: 网络整理| 查看: 265

百度翻译此文   有道翻译此文 问题描述

Currently I use the following code segment in MATLAB to read a PLY into a MATLAB matrix. Here is a sample PLY file. But it take a considerable time when the size of the PLY file is quite large.

Is there a better way to read a text file efficiently in MATLAB?

data = textread(fileName, '%s','delimiter', '\n'); data = data(15:length(data),1); data = (cellfun(@(x) strread(x,'%s','delimiter',' '), data, 'UniformOutput', false));

(This question is a part of my previous question listed here.)

推荐答案

You can use the dlmread function and make use of its ability to specify a starting position

>> data = dlmread(filename, ' ', 14, 0) data = 0.1054 -0.2731 0.8550 220.0000 195.0000 173.0000 255.0000 0 0.1008 -0.2754 0.8550 228.0000 202.0000 184.0000 255.0000 0 ... 0.1139 -0.2803 0.8490 221.0000 194.0000 172.0000 255.0000 0 0.1117 -0.2829 0.8500 225.0000 200.0000 178.0000 255.0000 0

The last two arguments specify the starting row and column of the data. The final zeros arise because each of the lines in your test file ends with a space. We can remove these with

>> data = data(:, 1:end-1);

The dlmread function reads in numeric data and removes the need for the conversion from a string to a double in my previous answer.



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3