Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Fully connected objects

1 visualización (últimos 30 días)
mohamad ali
mohamad ali el 16 de Feb. de 2011
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
Hey guys,
I have 5 objects that I need to connect all of them together so I can manipulate some data.I need something similar to linked list but for all objects to be able to access every other object.For example, am in object 1 and I wanted depending on a certain paramter to access object 2 or object 3 and then come back to 1.How can I do that in matlab if possible.
Have a good day.
  1 comentario
Walter Roberson
Walter Roberson el 16 de Feb. de 2011
You will need to clarify the difference between being "in" object 1, and "accessing" object 2.

Respuestas (1)

Roberto
Roberto el 26 de Abr. de 2014
I don't know if I got it, maybe you need to clarify; acceding objects from different functions can be achieved with different methods, nested functions in one of them. see this code:
function mainFunction(condition)
objCus1 = myClass ;
objCus2 = myClass ;
objCus3 = otherClass ;
switch condition
case 1
objCus3.prop1 = myFunc1 ;
case 2
objCus1.prop4 = myFunc2 ;
end
function myFunc1
objCus1.method1
if objCus2.prop1 == objCus3
objCus1.method2
end
end
function myFunc2
externalFunc(objCus1,objCus2,objCus3.someProperty);
return
end
end

La pregunta está cerrada.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by