Hi Matlab community! I just started on my first job and they have me learning Matlab for a project. However, I don't code very often or very well, so I'm having some problems with a couple of things in my code. If anyone has any explanations for how to improve my code that would be great!
So far I have created five Matlab codes with multiple substructures. In two of them I call the other structures as variables in equations. It looks similar to this:
function FruitCalc = FruitCalculations( Gravity, PhysicalConstants ) % Assignment Statements For Ease
det = Gravity.Detector; opt = Gravity.Optics; phys = PhysicalConstants; FruitCalc.Aerodynamics = (det.Strawberry - phys.Gravity) FruitCalc.FruitsDropped = (FruitCalc.Aerodynamics/phys.Gravity)*det.Oranges;end
Wherein Gravity and PhysicalConstants are other structures that are in the Matlab path. Here I assigned the substructures of Gravity.Detector to det, Gravity.Optics to opt, and PhysicalConstants = phys so that the longer calculations are more readable.
I keep getting the error in det=Gravity.Detector; of the following:
Reference to non-existent field 'Detector'.
Error in SNRCalculations (line 4)
det = Mission.Detector;
I believe it has something to do with assigning det and so on to substructures, but I'm not sure. If anyone has any ideas, or any ways I hsould improve my code, please help a girl out.
Best Answer