Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Dennis is right in saying that you probably should do some preprocessing, since you have multiple sets of braces and such. </p> <p>What you may be looking for is some way of basically sorting the lines of the file. If you're not worried about capturing the individual string fields, but just in re-ordering lines, you can read and sort according to the first field, which you know to be numbers. This is pretty hackish, but maybe you're looking for something like (this is essentially what Dennis suggests in the comments above):</p> <pre><code>clear all, clc fid = fopen('messagestore.txt'); n=1; nums = []; while 1 string = fgetl(fid); % get line if ~ischar(string), break, end % break if end of file for k = 1:length(string) if string(k) == ',' break end end nums = [nums str2num(string(2:k-1))]; MessageArray{n} = string; n=n+1; end [nums,I] = sort(nums); MessageArray = MessageArray(I); fclose(fid); % Print some output for k = 1:length(nums) disp(MessageArray{k}) end </code></pre> <p>which produces</p> <pre><code>{14430,modelupdate_complete}, {193220,message,ucontroller9,controller1,lowalarm,success}, {193220,message,controller1,changer,{change,down},success}, {193220,controlaction,tapchange_down,{oldsetting,0.975},{newsetting,0.95}}, {193220,modelupdate_start,changeup,changer,193220}, {278480,message,ucontroller6,controller1,highalarm,success}, {278480,message,controller1,changer,{change,up},success} </code></pre> <p>Now, I am not entirely sure how your timestamps work, here I literally sort the numerical value. But you should be able to get the basic idea from the code -- read the numbers from the first field into a vector and use that vector to sort the lines themselves. Whatever type of sorting your timestamps require can be performed by changing <code>[nums,I] = sort(nums)</code></p>
    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.
    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