From: Wayne King on
Walter Roberson <roberson(a)hushmail.com> wrote in message <twXJn.2274$mj4.851(a)newsfe08.iad>...
> Scarlett wrote:
> > Walter Roberson <roberson(a)hushmail.com> wrote in message
> > <4_VJn.16983$TL5.4043(a)newsfe24.iad>...
> >> Scarlett wrote:
> >> > Using the following few lines of code
> >> > > function F=sensklb(Io,Ho,s,a,b)
> >> > clear t;
> >> > syms t;
> >> > clear K;
> >> > clear F;
> >> > F=zeros(size(s));
> >> > K=1;
> >> > > I get the error
> >> > > ??? Error using ==> zeros
> >> > Trailing string input must be a valid numeric class name.
>
>
> > I'm using the matlab function for size.
> >
> > I added the disp(size(s)) function to the code, which returned 1 1. But
> > the error for my zeros command still showed up.
>
> Odd. Next I would double-check that you are using Matlab's zeros(), and
> then I would start trying to debug the zeros function itself (I am not
> sure if the source is available or not.)
>
> In the meantime, you can use
>
> SS = num2cell(size(s));
> F = repmat(typecast(0, class(s)), SS{:});

Hi Walter, Matt, and OP:
This is strange to me as well. The error the OP is getting usually results from trying something like:

X = ones(10,1);
test = zeros(size(X),'logical');

I guess the OP could try

zeros(size(s),'double');

but this really shouldn't be necessary...

Wayne
From: Matt Fig on
Put these lines in the function, after you remove those useless CLEAR calls, and tell what it returns to the command window:

which('zeros','s')
class(s)
From: Scarlett on
"Matt Fig" <spamanon(a)yahoo.com> wrote in message <ht9j91$46q$1(a)fred.mathworks.com>...
> Put these lines in the function, after you remove those useless CLEAR calls, and tell what it returns to the command window:
>
> which('zeros','s')
> class(s)


Since this is going to eventually be used as a nested function, I prefer to keep the clear commands in just to avoid unnecessary errors. After tinkering with some of everyone's suggestions it looks like I the problem is mostly solved. Thanks for the help everyone!
From: Matt Fig on
"Matt Fig" <spamanon(a)yahoo.com> wrote in message <ht9j91$46q$1(a)fred.mathworks.com>...
> Put these lines in the function, after you remove those useless CLEAR calls, and tell what it returns to the command window:
>
> which('zeros','s')
> class(s)

Oops, I forgot you were calling ZEROS with size(s). How about this, what does it return?

which('size','s')
which('zeros','size(s)')
class(s)