I've a issue with matlab constructors when I try to instantiate an array of classes.
I get the following error:
??? The following error occurred converting from volta to double:
Error using ==> double
Conversion to double from volta is not possible.
Error in ==> circuito>circuito.iniciarNovaVolta at 37
Circuito.Voltas(Circuito.Nvoltas) = Volta(Nmaxpiloto);
Error in ==> testes at 99
c1.iniciarNovaVolta(10);
And my code is:
function iniciarNovaVolta(Circuito, Nmaxpiloto)
Circuito.Voltas(Circuito.Nvoltas) = Volta(Nmaxpiloto);
Circuito.Nvoltas = Circuito.Nvoltas + 1;
end
The contructor at Volta class is:
function Volta=volta(Nmaxpiloto)
if(nargin>0)
%Volta.Melhortempovolta=Melhortempovolta;
Volta.Nmaxpiloto=Nmaxpiloto;
end
end
I had this issue more than once, but the types looks right. Could you tell me what I can't see ?
function Volta=volta(Nmaxpiloto)
if(nargin>0)