<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Thanks guys, and I will switch over to binary.  Just saying, that's what 2013b is doing.<div><br><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">-gideon</span>

</div>
<br><div><div>On Nov 30, 2013, at 4:12 PM, Jed Brown <<a href="mailto:jedbrown@mcs.anl.gov">jedbrown@mcs.anl.gov</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Gideon Simpson <<a href="mailto:gideon.simpson@gmail.com">gideon.simpson@gmail.com</a>> writes:<br><br><blockquote type="cite">If each realization generated a size n output, is there something slicker than this:<br><br>VecGetOwnershipRange(sim_data, &local_start, &local_end);<br><br>VecGetArray(sim_data,& sim_data_local);<br>k=0;<br><br>m_local = (local_end - local_start-1)/n;<br></blockquote><br>local_end is one past the last owned entry.<br><br><blockquote type="cite">for(i=0;i< m_local;i++){<br><br>   mc_sim_cod(mc_args, &sim_result);<br><br>   for(k = 0;k<n;k++){<br><br>      sim_data_local[i * n + k] = sim_result[k];<br>   }<br><br> }<br></blockquote><br>You can drop the result directly into the array:<br><br>  for (i=local_start; i<local_end; i+=n) {<br>    mc_sim_cod(mc_args, sim_data_local+(i-local_start));<br>  }<br><br><blockquote type="cite"><blockquote type="cite">Did MATLAB change their ASCII format?<br></blockquote><br>Here's a quick test on 2013b:<br>v = linspace(0,1,5);<br>save('test.out', 'v', '-ascii');<br><br>test.out looks like:<br>   0.0000000e+00   2.5000000e-01   5.0000000e-01   7.5000000e-01   1.0000000e+00<br></blockquote><br>ASCII_MATLAB output is meant to be sourced:<br><br>v = [<br>0.0000000e+00<br>2.5000000e-01<br>5.0000000e-01<br>7.5000000e-01<br>1.0000000e+00<br>];<br><br><blockquote type="cite"><blockquote type="cite">Anyway, it is much better to write binary output and read with<br>PetscBinaryRead (bin/matlab/PetscBinaryRead.m).<br></blockquote></blockquote><br>But seriously, use binary.<br></blockquote></div><br></div></body></html>