function [result1, result2] = matlabexample(filename) model = ofxModel; % Create an empty model VesselName = 'Vessel1'; model.CreateObject(ofx.otVesselType, 'VesselType1'); % Create a Vessel Type % Create a Vessel (it will use the Vessel Type just created) model.CreateObject(ofx.otVessel, VesselName); % Create a Line (a Line Type will be created automatically since none yet exist) line = model.CreateObject(ofx.otLine, 'Line1'); line.EndAConnection = VesselName; % Connect the Line top end to the Vessel line.EndBConnection = 'Anchored'; % anchor the Line bottom end % Set the Line end positions line.EndAX = 50.0; line.EndAY = 0.0; line.EndAZ = 10.0; line.EndBX = 220.0; line.EndBY = 0.0; line.EndBZ = 0.0; line.NumberOfSections = 2; % Give the line 2 sections % Set the section lengths and segmentation, first of all section 1 ... % Note the Matlab Interface is One based for indexed data items line.Length(1) = 90.0; line.TargetSegmentLength(1) = line.Length(1) / 20; % ... and then section 2 line.Length(2) = 130.0; line.TargetSegmentLength(1) = line.Length(2) / 15; % Setup wave train data environment = model.environment; environment.NumberOfWaveTrains = 2; function SetWaveTrainData(WaveTrainName, Hs, Direction) environment.SelectedWaveTrain = WaveTrainName; environment.WaveTrainType = 'JONSWAP'; environment.WaveTrainHs = Hs; environment.WaveTrainDirection = Direction; end SetWaveTrainData('Wave1', 4.0, 120.0); SetWaveTrainData('Wave2', 3.7, 67.0); model.SaveData(filename); % Save the model model.CalculateStatics; model.RunSimulation; % Get time history and range graph results from line result1 = line.TimeHistory('Effective Tension', ofx.oeEndA); result2 = line.RangeGraph('Bend Moment', ofx.oeArcLength(25.0)); % No need to explicitly destroy the model end