Results 1 to 2 of 2

Math Help - Help with Matlab Script

  1. #1
    Newbie
    Joined
    Apr 2010
    Posts
    1

    Help with Matlab Script

    Our script works properly when it doesn't have to incorporate the very beginning portion to read 16 different sheets titled u1-u16 in our Excel file. Why won't the first part of our string work (in red)?
    (and yes our filename is correct)


    for k=1:16

    name=['u', num2str(k)]
    AA=xlsread('dataB.xlsx','name')




    AB=AA>=.8 & AA<=1.2;


    g=ones(3) ;



    for j=1:14
    for i=1:14

    if AB(i:2+i,j:2+j)==g(1:3,1:3)
    A(j,i)=1;
    else
    A(j,i)=0;
    end
    end
    end

    end


    imagesc(AB)
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Member
    Joined
    Mar 2007
    Posts
    206
    Awards
    1
    Try changeing

    Code:
    AA=xlsread('dataB.xlsx','name')
    to

    Code:
    AA=xlsread('dataB.xlsx',name)
    You want to pass the variable "name" not the string 'name'

    I haven't tested it, but I would suspect that you should be ok if you modify that line.

    Elbarto
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Trying to script the General Beta 2 CDF in MATLAB
    Posted in the Math Software Forum
    Replies: 2
    Last Post: July 18th 2011, 12:55 PM
  2. is there a way to kill a script in matlab?
    Posted in the Math Software Forum
    Replies: 3
    Last Post: August 6th 2010, 05:21 AM
  3. Replies: 1
    Last Post: March 5th 2010, 04:11 AM
  4. Matlab help can't write script
    Posted in the Math Software Forum
    Replies: 2
    Last Post: January 28th 2010, 06:00 AM
  5. MATLAB and using the script for RK4 method
    Posted in the Math Software Forum
    Replies: 1
    Last Post: April 8th 2009, 04:33 AM

Search Tags


/mathhelpforum @mathhelpforum