Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>About <code>y=~isnan(x)</code>, you are right.</p> <p>The line with <code>x(k,y(k,:))</code> will give the not-Nans in the <code>k</code>-th row of <code>x</code>. So it seems that <code>z</code> is gathering the not-Nans values of <code>x</code> (in a weird way). Note that <code>y(k,:)</code> acts as a logical index for the columns, where <code>true</code> means "include that column" and <code>false</code> means "do not include".</p> <p>As for your last question: <code>[z{:,:}]</code> is in this case equivalent to <code>[z{:}]</code>, because <code>z</code> has one dimension only, and it will horizontally concatenate the contents of the cell array <code>z</code>. For example, with <code>z{1} = [1; 2]; z{2} = [3 4; 5 6];</code> it will give <code>[1 3 4; 2 5 6]</code>. Thus <code>m</code> will be the <em>common</em> number of rows in the matrices that make up <code>z</code>, and <code>n</code> will be the sum of the numbers of columns (in my example <code>m</code> will be 2 and <code>n</code> will be 3). If there is no such common number of rows it will give an error. For example, if <code>z{1} = [1 2]; z{2} = [3 4; 5 6];</code> then <code>[z{:}]</code> or <code>[z{:,:}]</code> give an error.</p> <p>So the final result <code>d</code> is just a row vector which contains the not-Nans from <code>x</code> ordered by increasing row and then increasing column. That could have been obtained more easily as</p> <pre><code>xt = x.'; d = xt(~isnan(xt(:))).'; </code></pre> <p>which is more compact, more Matlab-like, and probably faster.</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.
    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