Matlab - modify class attributes -


i'm trying simulate car's position matlab. far have created class representing car public attributes position (obj.position), speed (obj.vist) , delta (obj.delat). delta represents time steps. when let car drive want change it's position adding actual speed. unfortunately isn't working...

the code

fprintf(' \n position: %4.0f',  obj.position ); obj.position = obj.position + obj.vist*obj.delta; fprintf(' \n position: %4.0f',  obj.position ); 

creates following output:

position: 1000 position:  

what doing wrong? has handle or value class? i'm pretty sure question stupid im starting work matlab i'm needing here...

thanks in advance.

the class definition:

classdef mycar < handle     %untitled summary of class goes here     %   detailed explanation goes here  properties     id;     typ;     startzeit;     vstart;     posstart;      position;     vist;     vsoll;     vmax;     laenge;     aktiv = false;     vmaxstrecke;      poi;     vpoi;     poiaktiv = false;      bremswegzumpoi;     bremsverzoegerung = 0.8;      ageg = [];     vgeg = [];     delta;      zeitlinie = [];     vistlinie = [];     poslinie= [];     vsolllinie = []; end  methods     function drive(obj, time)             fprintf(' \n in fahre: %4.0f',  obj.position );             obj.position = obj.position + obj.vist*obj.delta;             fprintf(' \n in fahre: %4.0f',  obj.position );              obj.zeitlinie = [obj.zeitlinie, time];             obj.vistlinie = [obj.vistlinie, obj.vist];     end end end 

the method drive called script managing several cars.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -