Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>To get the file ID, use regular expressions, e.g.:</p> <pre><code>filename = 'Processed_0123456_1'; file_id_str = regexprep(filename, 'Processed_(\d+)_\d+', '$1'); file_num_str = regexprep(filename, 'Processed_\d+_(\d+)', '$1') </code></pre> <p>To read in the file contents, assuming that it's all comma-separated values without a header, use textscan, e.g.,</p> <pre><code>fid = fopen(filename) C = textscan(fid, '%f,%f,%f') % Use as many %f specifiers as you have entries per line in the file </code></pre> <p>textscan also works on strings. So, for example, if your file contents was:</p> <pre><code>filestr = sprintf('1, 2, 3\n1, 3, 3') </code></pre> <p>Then running textscan on <code>filestr</code> works like this:</p> <pre><code>C = textscan(filestr, '%f,%f,%f') C = [2x1 int32] [2x1 int32] [2x1 int32] </code></pre> <p>You can convert that to a matrix using cell2mat:</p> <pre><code>cell2mat(C) ans = 1 2 3 1 3 3 </code></pre> <p>You could then repeat this procedure for all files with the same ID and concatenate them into a single matrix, e.g.,</p> <pre><code>C_full = []; for (all files with the same ID) C = do_all_the_above_stuff; C_full = [C_full; C]; end </code></pre> <p>Then you can look for what you want in <code>C_full</code>.</p> <p><strong>Update based on updated OP Dec 12, 2013</strong></p> <p>Here's code to read the values from a single file. Wrap this all in the the loop that I mentioned above to loop over all your files and read them all into a single matrix.</p> <pre><code>fid = fopen('/path/to/file'); % Skip over 12 header lines for kk = 1:12 fgetl(fid); end % Read in values to a matrix C = textscan(fid, '%f,%f,%f'); C = cell2mat(C); </code></pre>
    singulars
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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