Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Very weird: Conversion to double from struct is not possible.

2,166 views
Skip to first unread message

Bogdan

unread,
Sep 22, 2010, 12:54:05 PM9/22/10
to
Hi all,

I'm pressed with time and I've only recently started receiving this error:

"Conversion to double from struct is not possible."

This appears whenever I use 'get' or 'set' on gca, which used to work and should normally work. For instance:

figure
plot(rand(100,1))
get(gca)

should return the axes properties .. in my case, I get the above error. The Matlab installation at home does not have this problem.

Any clues? Many, thanks in advance.

Malcolm Lidierth

unread,
Sep 22, 2010, 1:08:05 PM9/22/10
to
It looks like you have used gca as a variable name somewhere in you code so MATLAB now treats it as a variable not a function. If you have assigned a structure to it, that explains the message,

Bogdan

unread,
Sep 22, 2010, 1:16:22 PM9/22/10
to
I came back to post the same thing but you beat me to it. i didn;'t even consider looking in the workspace for a variable called "gca" because I would never asign anything to "gca" ... but there you go, apparently I did.

Thanks!

alex.ma...@gmail.com

unread,
Aug 13, 2013, 6:43:18 AM8/13/13
to

hello, this is my code wich i wrote using simulink :

RR=1.5;
RS=1.2; % according to the table on page 17 for a class
%myu0=4*pi*10^(-7);
LR=2;%(myu0*pi*l1*l2*Nr^2/8*g);
LS=1;%(myu0*pi*l1*l2*Ns^2/8*g);
TL=0.23;
J=0.005; % according to the table on page 17 for a class
np=4;
M=0.2;%(k*myu0*pi*l1*l2*Ns*Nr/8*g);
F=0.3;
sigma=(1-M^2/LR*LS);
Z=(1/sigma*LS);
myu=np*M/J*LR;
beta=(M/sigma*LR*LS);
heta=(RR/LR);
alfa=(M^2*RR/sigma*LR^2*LS + RS/sigma*LS);
tldivj=TL/J;
FdivJ=F/J;
sim ('motorproject1')
figure(1)
xlabel('t(sec)');
ylabel('teta(radian)');
plot(t,teta,'r')
grid on
figure(2)
xlabel('t(sec)');
ylabel('omega(radian/second)');
plot(t,omega,'b')
grid on
figure(3)
xlabel('t(sec)');
ylabel('psay_ra(henry)');
plot(t,psay_ra,'g')
grid on
figure(4)
xlabel('t(sec)');
ylabel('psay_rb(henry)');
plot(t,psay_rb,'y')
grid on
figure(5)
xlabel('t(sec)');
ylabel('isa1(amper)');
plot(t,isa1,'p')
grid on
figure(6)
xlabel('t(sec)');
ylabel('isb(amper)');
plot(t,isb,'b')
grid on

and it gives me an error : ??? Error using ==> plot
Conversion to double from struct is not possible.

Error in ==> programformotor at 26
plot(t,teta,'r')

and i dont know what to do about it, please help

thank you :)

alex.ma...@gmail.com

unread,
Aug 13, 2013, 6:46:12 AM8/13/13
to
> and allso it gives me a warning :
Warning: Using a default value of 0.2 for maximum step size. The
simulation step size will be equal to or less than this value. You
can disable this diagnostic by setting 'Automatic solver parameter
selection' diagnostic to 'none' in the Diagnostics page of the
configuration parameters dialog.
> In programformotor at 22
>
> thank you :)

dpb

unread,
Aug 13, 2013, 9:48:29 AM8/13/13
to
On 8/13/2013 5:43 AM, alex.ma...@gmail.com wrote:
>
> hello, this is my code wich i wrote using simulink :
>
...

> plot(t,teta,'r')

...

> and it gives me an error : ??? Error using ==> plot
> Conversion to double from struct is not possible.
>
> Error in ==> programformotor at 26
> plot(t,teta,'r')
...

That's the first place 'teta' shows up -- what is it/where's it defined?

The error message indicates it's a structure, not a array/vector so
you'll need to reference a member thereof instead of the structure itself...

--

0 new messages