Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9135453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:49:34+00:00 2026-06-17T08:49:34+00:00

I am trying to write an array of coefficients into an Excel file under

  • 0

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:
enter image description here

However, my code just keeps creating other sheets. What is the proper way to implement this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T08:49:35+00:00Added an answer on June 17, 2026 at 8:49 am

    The problem is in the xlswrite lines:

    From xlswrite documentation:

    xlswrite(filename,A,sheet) writes to the specified worksheet.

    That means you are writing string ‘b’ to sheet ‘A1’ with xlswrite(filename,'b','A1');

    xlswrite(filename,A) writes array A to the first worksheet in Excel
    file, filename, starting at cell A1.

    You actually do not need to do anything to start writing at A1. Assuming b is a row vector:

    xlswrite(filename,b');
    

    as you have written, should suffice.

    If you want to specify sheet and column you can use

    xlswrite(filename,A,sheet,xlRange)
    

    Update: I cannot try this right now but I think it should work.

    You can calculate a and b for every order and write them to an xls file like this:

    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
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a matrix into a text file. In order to do
I'm trying to write an RBGA pixel array to file using code found here
I'm trying to write a 2d array into an output file, it's all working
I am trying to write to a file an array of object serialised into
I'm trying to write binary search tree's content to temporary array in order to
I'm trying to write an array constructor for Excel as a worksheet function using
I'm trying to write an array of objects that implement Parcelable into a Parcel
I'm trying to write the contents of an array to a text file. I've
I have been trying to write an array to a file. I know how
I am trying to write/read multibyte array directly to/from file, and was suggested using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.