Instantiating Object Arrays with superclass call
Mostrar comentarios más antiguos
Hi, I've wrote a baseStation class matlab class, which constructor is given as following:
function obj = baseStation(btscoord,btsid,attachedcell,aa,tx,sirmin,rxmax,rxmin,txmax,txmin)
nargin
if nargin <3
aa=0;
tx=0;
sirmin=0;
rxmax=0;
rxmin=0;txmax=0;txmin=0;
end
%call the superconstructor
obj = obj@btsRadio(aa,tx,sirmin,rxmax,rxmin,txmax,txmin);
%initiate class variable
obj.btsID = btsid;
obj.btsCoord = btscoord;
obj.attachedCell = attachedcell;
obj.btsInfo = importdata('btsInfo.mat');
end
when i try to call it in a nested for-loop, the second loop doesn't execute and an error occur : not enougth imput argument. The subclass baseStation seems not to receive arguments from last loop. I actually want to create an array object. Do someone tell me what I'm doing wrong?
thanks for your help
Bolivar
Respuestas (1)
Muthu Annamalai
el 27 de Jun. de 2013
Editada: Muthu Annamalai
el 27 de Jun. de 2013
0 votos
Will you be posting the exact error message? That would help solve your problem.
I suspect you are running into problems with subscripting the object. Try instead, to create the first object as, a(1) = baseStation(args{:}) a(2) = baseStation(args{:})
should work and build what you are looking for.
4 comentarios
Bolivar
el 27 de Jun. de 2013
Bolivar
el 27 de Jun. de 2013
Sean de Wolski
el 27 de Jun. de 2013
@Bolivar: What about using repmat()?
Bolivar
el 1 de Jul. de 2013
Categorías
Más información sobre Construct and Work with Object Arrays en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!