<div class="gmail_quote">Hi,<br><div><br></div><div>I have point cloud data in the form of 3 vectors, x y z which are n-by-1 and contain the 3 coordinates of the points. I am trying to swiftly generate a .vtk file in MATLAB so I can view it in Paraview, but I am having trouble understanding the documentation at <a href="http://www.vtk.org/VTK/img/file-formats.pdf" target="_blank">http://www.vtk.org/VTK/img/file-formats.pdf</a></div>


<div><br></div><div>I have written some code, where I write the points as an unstructred grid, but paraview doesn&#39;t show anything when I try to view the file.</div><div><br></div><div>Here&#39;s my code:</div><div><br>


</div><div><div>function [] = write_vtk(x,y,z)</div><div><br></div><div>    n=size(x);</div><div>    delete(&#39;data.vtk&#39;);</div><div>    fid=fopen(&#39;data.vtk&#39;,&#39;w&#39;);</div><div>    fprintf(fid,&#39;# vtk DataFile Version 2.0\n&#39;);</div>


<div>    fprintf(fid,&#39;blah\n&#39;);</div><div>    fprintf(fid,&#39;ASCII\n&#39;);</div><div>    fprintf(fid,&#39;DATASET UNSTRUCTURED_GRID\n&#39;);</div><div>    fprintf(fid,&#39;POINTS %d float\n&#39;,n);</div><div>

    for i=1:n</div>
<div>        fprintf(fid,&#39;%f %f %f\n&#39;,x(i),y(i),z(i));</div><div>    end</div><div>    fprintf(fid,&#39;POINT_DATA %d\n&#39;,n);</div><div>    fclose(fid);</div><div>     </div><div><br></div><div>end</div></div>

<div>
<br></div><div>What am I doing wrong?</div><div><br></div><br clear="all">Haluk Noyan Tokgozoglu<div><br></div><div>Johns Hopkins University</div><div>Computer Science PhD Student</div><div>Computational Interaction and Robotics Library</div>


<div>Secretary of the GRO</div><div>Treasurer of UPE</div><br>
</div><br>