Paul,<div><br></div><div>This is a good guess. I have played with this already and Paraview would read the points okay (for big ended write), but it would crash when reading the cell data:</div><div><br></div><div>…</div><div>
<div>for k=1:length(Connectivity)</div><div> f=Connectivity{k};</div><div> ctype=zeros(size(f, 1),1)+Cell_types{k};</div><div> fprintf(fid,'CELLS %d %d\n',size(f,1),(size(f,1)*(size(f,2)+1)));%</div>
<div> if (~binary)</div><div> for i= 1:size(f, 1)</div><div> fprintf(fid,'%d ',size(f,2));</div><div> for j= 1: size(f,2)</div><div> fprintf(fid,'%d ',f(i,j)-1);</div>
<div> end</div><div> fprintf(fid,'\n');</div><div> end</div><div> else</div><div> fwrite(fid,cast([zeros(size(f,1),1)+size(f,2),f-1],'int32'),'int32','b');</div>
<div> end</div><div> fprintf(fid,'\n');</div><div> fprintf(fid,'\n');</div><div> fprintf(fid,'CELL_TYPES %d\n',size(f,1));%</div><div> if (~binary)</div><div> for i= 1:size(f, 1)</div>
<div> fprintf(fid,'%d\n',ctype(i));</div><div> end</div><div> else</div><div> fwrite(fid,cast(ctype,'int32'),'int32','b');</div><div> end</div>
<div> fprintf(fid,'\n');</div><div> fprintf(fid,'\n');</div><div> end</div><div>…</div><div><br></div><div>There is something wrong in the code above (or there's a bug in paraview). By the way my Matlab code that writes out binary *structured_grid* data works just fine with paraview.</div>
<div>It is just the unstructured grid that's giving me headaches.</div><div><br></div><div>Petr</div><br><div class="gmail_quote">On Sun, Jul 29, 2012 at 8:29 PM, Paul McIntosh <span dir="ltr"><<a href="mailto:paul.mcintosh@internetscooter.com" target="_blank">paul.mcintosh@internetscooter.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>
<div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial">Maybe c</font></span><span><font color="#0000ff" face="Arial">heck the endianess - to read a binary file that
was generated in MATLAB I had to change the endianess. I think there is a VTK
util on the MATHWORKS site but I haven't tried that.</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial">Paul</font></span></div><br>
<div dir="ltr" lang="en-us" align="left">
<hr>
<font face="Tahoma"><b>From:</b> <a href="mailto:paraview-bounces@paraview.org" target="_blank">paraview-bounces@paraview.org</a>
[mailto:<a href="mailto:paraview-bounces@paraview.org" target="_blank">paraview-bounces@paraview.org</a>] <b>On Behalf Of </b>Petr
Krysl<br><b>Sent:</b> Saturday, 28 July 2012 1:37 AM<br><b>To:</b>
<a href="mailto:paraview@paraview.org" target="_blank">paraview@paraview.org</a><br><b>Subject:</b> Re: [Paraview] Do anyone have examples
of writing binary file with mesh and results data?<br></font><br></div><div><div class="h5">
<div></div>Hi,
<div><br></div>
<div>Did you ever get the Matlab writing of the binary VTK files to work?
I'm having problems with them too: PV crashes when reading the binary
files.<br clear="all">
<div><br></div>
<div>Thanks,</div>-- <br>Petr Krysl
<div>University of California, San Diego</div>
<div>Skype: <a href="http://Petr.Krysl.UCSD.EDU" target="_blank">Petr.Krysl.UCSD.EDU</a></div>
<div><a href="http://hogwarts.ucsd.edu/~pkrysl/" target="_blank">http://hogwarts.ucsd.edu/~pkrysl/</a></div><br></div></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Petr Krysl<div>University of California, San Diego</div><div>Skype: <a href="http://Petr.Krysl.UCSD.EDU" target="_blank">Petr.Krysl.UCSD.EDU</a></div><div><a href="http://hogwarts.ucsd.edu/~pkrysl/" target="_blank">http://hogwarts.ucsd.edu/~pkrysl/</a></div>
<br>
</div>