Efficient Means of Emulating a Pointer
Afficher commentaires plus anciens
Hello All,
I am writing a program wherein I am using 2 main structs to pass data to function & subfunctions. Depending on the dataset 'well' could be 1x1 up to 1x16 and 'stage' could be 1x1 up to 1x100+
well = 1x3 struct array containing the fields:
name
coords
pp
x
stageNums
stageNumbersIndices
perfCoordinates
stageNames
stage = 1x68 struct array containing the fields:
treatmentWell
wellOrder
name
num
E
N
Z
time
conf
mag
color
slope
azimuth
line
center
EE
NN
ZZ
Some things I was considering here as I clean up the code for beta testing within my group:
1. A sensible parent-child relationship would be 'well'>'stage', with 'stage' as a nested struct within 'well' but that would alter the IO flow of the program as the user interacts with the GUI & plots, so I can't do that without a serious overhaul (not out of the question, but not happening this week). A lazy (but effective) practice would be to nest the correct 'well' struct into every cell of the 'stage' struct but it seems very inefficient.
2. Right now I am using the dummy 'wellOrder' which is an index (in this case 1, 2 or 3) to the proper cell in the 'well' struct and passing both the 'well' and 'stage' structs to each function. Ideally I could pass a pointer to 'well' in the 'stage' struct, but it doesn't seem possible within MATLAB, does anyone know of an efficient way to emulate a pointer in MATLAB?
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!