I am trying to write an array of coefficients into an Excel file under 1 column (A1). Here is my snippet:
filename = 'cheby2coefs.xlsx';
for Order = 1:1
fprintf('This is');
disp(Order);
[b,a] = cheby2(Order, 20, 300/500);
disp([b,a]);
%xlswrite(filename,{'Order ',Order},'A1'); %string
xlswrite(filename,'b','A1'); %string
xlswrite(filename,b');
xlswrite(filename,'a'); %string
xlswrite(filename,a');
end
The output that i aim for is something like this:

However, my code just keeps creating other sheets. What is the proper way to implement this?
The problem is in the
xlswritelines:From
xlswritedocumentation:That means you are writing string ‘b’ to sheet ‘A1’ with
xlswrite(filename,'b','A1');You actually do not need to do anything to start writing at A1. Assuming b is a row vector:
as you have written, should suffice.
If you want to specify sheet and column you can use
Update: I cannot try this right now but I think it should work.
You can calculate
aandbfor everyorderand write them to an xls file like this: