From: dpb on
Brandon wrote:
....

> but the error message
> ??? Conversion to double from struct is not possible.
>
> Error in ==> P4_2 at 12
> M(t+1)=getframe;
> still persists...

I didn't see that line in the code posted and I've never used getframe
but it appears your asking for it inside a loop before there's any
plotting gone on???

--
From: ImageAnalyst on
On Dec 3, 9:07 pm, "Brandon " <bflickin...(a)umail.ucsb.edu> wrote:
> this is driving me crazy... can someone please help me figure this out?

Did you try braces instead of parentheses?
From: Eric on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <66c682b2-ff33-402d-9ed3-3577c1d4c3c2(a)33g2000vbe.googlegroups.com>...
> On Dec 3, 9:07?pm, "Brandon " <bflickin...(a)umail.ucsb.edu> wrote:
> > this is driving me crazy... can someone please help me figure this out?
>
> Did you try braces instead of parentheses?

@ dpb, that shouldn't give him an error, but its definitely not going to help him make a movie. It'll just be a blank movie.

And i tested it out and braces don't work, but normal parentheses work fine. I get no error. But until you plot something, you will get a blank movie. So just plot within your loop before getframe. Just for clarity, here is the code that gives me no errors:

kappa = 1*10^-12; %mm^2/s
Ts = 86400; %temperature fluctuation in section
To = 20; %initial temperature in celsius
deltaT = 5; %change in temperature in celcius
t = 0;
omega = 2*pi/Ts;
z = 0:150;
alpha = sqrt(omega/(2*kappa));

for t=0:1:100
T = To + deltaT*exp(-alpha*z).*cos(omega*t-alpha*z);
M(t+1)=getframe;
end
movie(M)

Let me know what happens next.
From: Steven Lord on

"Brandon " <bflickinger(a)umail.ucsb.edu> wrote in message
news:hf9pla$ilk$1(a)fred.mathworks.com...
> "Eric " <nxtgretzky88(a)aol.com> wrote in message
> <hf9p6b$jlu$1(a)fred.mathworks.com>...
>> The error it gave you tells you exactly whats wrong. 0 is not a positive
>> integer.
>
> I replaced the zero, so the code now reads:

*snip*

> but the error message
> ??? Conversion to double from struct is not possible.
>
> Error in ==> P4_2 at 12
> M(t+1)=getframe;
> still persists...

Execute this command:

dbstop if error

then run your code. When you reach this error, look at the output of the
WHOS function. More than likely, the variable M will be a double array
(created as such earlier in your code -- if I had to guess, I'd say you had
a line like "M = [];" earlier in the code, yes?) When you try to assign an
instance of one type into an array of another type using subscripted
assignment, MATLAB has to convert the instance on the right-hand side of the
equals sign into the type of the left-hand side array. If I'm correct that
M is a double array, since GETFRAME returns a struct, that means it needs to
convert _from_ a struct _to_ a double array. However, there's no such
conversion function defined in MATLAB, and so you receive this error.

The way to fix this is to make sure that M is not a double array when you
try to execute that line. M should be either a struct array (as returned by
GETFRAME) or it should not exist.

Once you've finished with debugging this in debug mode (the K>> prompt) use
DBQUIT and DBCLEAR to exit debug mode and disable the "dbstop if error"
behavior.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ