Results 1 to 2 of 2

Thread: Matlab question... xlswrite

  1. #1
    Jul 2010

    Matlab question... xlswrite

    First I'd like to say hello, second, i have a question.

    I'm using the xlswrite command in matlab to generate a set of data 36 excel books. Now I need to extract the data back out which I can do with xlsread, however it's the compiling of this data that's becoming tricky.

    I'm now trying to compile each sample set into their own compiled sheet of data, since not all 36 samples are from the same set. I've gotten all of the bugs worked out of writing the compiled data to separate work books with the exception of one.

    I need xlswrite to write the data from each sample book into the compiled book separated by a column, so it would read left to right sample1->2->3... I can get it to write the sample data in one giant column but it doesn't meet the requirements given to me.

    I found a script that will properly change a number into letter to correspond to excel columns (xlscolnum2str), however, when i try to pair this into the xlswrite command, i get a rather nasty error about how it needs to be in A1 format.

    the basic code looks like this.
    col=xlscolnum2str((ii-1)*2)+1); %data sets are two columns wide.
    aa='1'; %row that I want the data written two
    bb='2'; %row that I want the data written two
    aaa=strcat(col,aa); %etc for all the different data pulled from xlsread

    if i put in the variables and execute the last line it returns 'A1', for ii=1, which is stored in a variable aaa, and put into the xlswrite cmd as follows.


    and I get the error.

    I apologize about the lengthy post, but I wanted to get as much information as I could that was relevant.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Mar 2007
    I assume you are currently writing your data in a numeric matrix? If you require your data to be separated by a column, you could prepare all of your data into a cell array and write that to file, giving you much more control of the format I believe.

    Write Microsoft Excel spreadsheet file - MATLAB

    I haven't tried it, but give the cell array method a shot and see how you get on. Worst case scenario is you can format the data in excel with a few lines of VBA.

    Regards Elbarto
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Question in matlab
    Posted in the Math Software Forum
    Replies: 5
    Last Post: Jan 8th 2011, 04:07 AM
  2. Question in matlab
    Posted in the Advanced Math Topics Forum
    Replies: 2
    Last Post: Jan 4th 2011, 02:53 AM
  3. Need help with MATLAB question
    Posted in the Math Software Forum
    Replies: 1
    Last Post: Feb 4th 2010, 03:20 AM
  4. Matlab Question Help
    Posted in the Math Software Forum
    Replies: 6
    Last Post: Sep 20th 2009, 09:57 PM
  5. A Matlab Question
    Posted in the Math Software Forum
    Replies: 2
    Last Post: Aug 8th 2009, 12:02 AM

Search Tags

/mathhelpforum @mathhelpforum