Note that there are some explanatory texts on larger screens.

plurals
  1. POMatlab: Import multiple data sets from one text file
    primarykey
    data
    text
    <p>So I've got a script that parses some data for me in a different environment and I'm outputting those data to file, which I'd later like to read in to MATLAB. However, if I write, say, 10 data sets into the same file (the ideal situation), MATLAB will just read the first one in. Ideally, I'd like to to read in a cell array of structs containing the results of the import. I have some leeway with how I output the files, but basically it has to be something simple that I can write one line at a time.</p> <p>Unfortunately it would be very difficult to just append additional data sets as columns. Here's an example of some sample data:</p> <pre><code>DataSet1 x y z 3.82724 60.8234 13.0031 3.79987 60.909 -8.89291 3.75338 60.9124 19.5031 3.67715 61.0104 -24.5894 3.68124 61.0889 -20.8511 3.88438 61.1817 34.891 3.71405 61.2379 16.31 3.85504 61.245 -19.3778 4.09736 68.85 5.86954 3.39505 69.9457 64.8669 3.36033 69.9552 -58.8838 3.39427 70.9253 -26.0232 3.35769 70.9523 18.7863 DataSet2 x y z 3.73244 60.597 -21.6651 3.81217 60.712 -29.5505 3.74396 60.7554 -43.6225 3.70079 60.8271 -69.0996 3.87417 60.8662 -49.8068 3.74371 61.6553 34.915 3.815 61.7063 28.5842 3.88035 61.802 78.4314 </code></pre> <p>Ideally I'd like to keep this sort of structure. The best alternatives I see are to write to tons of different files (not ideal), or to write it to one long array and then have some header information in there indicating where each dataset starts. Again, not an ideal situation. Is there any way to use something similar to importdata()?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload