You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: simulation2app.m
    path of file: ./repos/celes/src/gui
    
    the code of the file until where you have to start completion: %  Copyright (c) 2017, Amos Egel (KIT), Lorenzo Pattelli (LENS)
%                      Giacomo Mazzamuto (LENS)
%  All rights reserved.
%
%  Redistribution and use in source and binary forms, with or without
%  modification, are permitted provided that the following conditions are met:
%
%  * Redistributions of source code must retain the above copyright notice, this
%    list of conditions and the following disclaimer.
%
%  * Redistributions in binary form must reproduce the above copyright notice,
%   
    
function simulation2app(simulation,app)

app.simulation = simulation;

% fields of simulation.input object
app.WavelengthEditField.Value = simulation.input.wavelength;
app.BackgroundRefractiveIndexEditField.Value = simulation.input.mediumRefractiveIndex;

% fields of simulation.input.particles object
app.particlePositions = simulation.input.particles.positionArray;
app.particleRefractiveIndices = simulation.input.particles.refractiveIndexArray;
app.particleRadii = simulation.input.particles.radiusArray;

% fields of simulation.input.initialField object
app.AmplitudeEditField.Value = simulation.input.initialField.amplitude;
app.PolarizationDropDown.Value = simulation.input.initialField.polarization;
app.InitialBeamWaistEditField.Value = simulation.input.initialField.beamWidth;
foc = simulation.input.initialField.focalPoint;
app.InitialFocusXEditField.Value = foc(1);
app.InitialFocusYEditField.Value = foc(2);
app.InitialFocusZEditField.Value = foc(3);

% fields of simulation.numerics object
app.lmaxEditField.Value = simulation.numerics.lmax;
app.LookupTableResolutionEditField.Value = simulation.numerics.particleDistanceResolution;
app.ComputeOnGPUCheckBox.Value = simulation.numerics.gpuFlag;
app.CustomPolarGridCheckBox.Value = true;
app.PolarResolutionEditField.Enable = 'off';
app.polarGrid = simulation.numerics.polarAnglesArray;
app.CustomAzimuthalGridCheckBox.Value = true;
app.AzimuthalResolutionEditField.Enable = 'off';
app.azimuthalGrid = simulation.numerics.azimuthalAnglesArray;

app.SolverTypeDropDown.Value = simulation.numerics.solver.type;
app.PreconditionerDropDown.Value = simulation.numerics.solver.preconditioner.type;
edgsiz = simulation.numerics.solver.preconditioner.partitionEdgeSizes;
app.PreconditionerPartitionXEditField.Value = edgsiz(1);
app.PreconditionerPartitionYEditField.Value = edgsiz(2);
app.PreconditionerPartitionZEditField.Value = edgsiz(3);

app.SolverToleranceEditField.Value = simulation.numerics.solver.tolerance;
app.SolverMaxiterEditField.Value = simulation.numerics.solver.maxIter;

app.FieldEvaluationCheckBox.Value = false;
end