Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The problem is in the <code>xlswrite</code> lines:</p> <p>From <a href="http://www.mathworks.com/help/matlab/ref/xlswrite.html" rel="nofollow"><code>xlswrite</code></a> documentation:</p> <blockquote> <p><code>xlswrite(filename,A,sheet)</code> writes to the specified worksheet.</p> </blockquote> <p>That means you are writing string 'b' to sheet 'A1' with <code>xlswrite(filename,'b','A1');</code></p> <blockquote> <p><code>xlswrite(filename,A)</code> writes array A to the first worksheet in Excel file, filename, starting at cell A1.</p> </blockquote> <p>You actually do not need to do anything to start writing at A1. Assuming b is a row vector:</p> <pre><code>xlswrite(filename,b'); </code></pre> <p>as you have written, should suffice.</p> <p>If you want to specify sheet and column you can use</p> <pre><code>xlswrite(filename,A,sheet,xlRange) </code></pre> <hr> <p><strong>Update:</strong> I cannot try this right now but I think it should work. </p> <p>You can calculate <code>a</code> and <code>b</code> for every <code>order</code> and write them to an xls file like this:</p> <pre><code>r = 1; % row number str = {'a', 'b'}; order = [1 3 5]; % The orders you want to calculate a and b with for idx = 1:size(order, 2) [b,a] = cheby2(order(idx), 20, 300/500); % I do not know about second % and third parameters, you should % check them. vals = [a; b]; % assuming they are row vectors cellName = strcat('A', r); orderName = strcat('Order ', order(idx)); xlswrite(filename, orderName, 1, cellName) r = r + 1; for jdx=1:2 cellName = strcat('A', r); xlswrite(filename, str{jdx}, 1, cellName); r = r + 1; cellName = strcat('A', r); xlswrite(filename, vals(jdx, :), 1, cellName); r = r + size(vals, 2); end end </code></pre>
 

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