Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>What does work is this:</p> <pre><code>OP=textscan((Parameters{a,1}),'%s','whitespace','','delimiter',' ''(),','multipledelimsasone',true); Par{a,1} = OP{2}; titles{1,a} = Par{a,1}; </code></pre> <p>As for why your original code didn't work, it's because sscanf reads %s until whitespace:</p> <p>Your string is:</p> <pre><code>vi('$Excitation', '0A', '0A', '0A') </code></pre> <p>Putting <code>vi(</code> at the start of your formatstring means it gets ignored, so the '%s' is searching through this:</p> <pre><code>'$Excitation', '0A', '0A', '0A') </code></pre> <p>It reads until it hits whitespace: <code>'$Excitation',</code> and so this matches your first <code>%s</code>. The comma you are inserted into the formatstring is ignored until the %s is first dealt with, which is why it didn't do what you expected.</p> <p>What remains is then</p> <pre><code>'0A', '0A', '0A') </code></pre> <p>Which doesn't really match the rest of your formatstring: <code>, %*s, %*s, %*s,%*s')</code> so the output isn't as expected.</p> <p>What I did was use textscan which allows you to specify what delimiters or whitespace you want to use to split strings. So I stopped it splitting strings with spaces by telling it to use no whitespace, and instead told it to use <code>space</code>, <code>'</code>, <code>left and right brackets</code>, and <code>comma</code> as delimiters to split the sentence up, and if there are two or more delimiters in a row, count them as a single break (otherwise you get empty cell elements).</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. 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