Class Encoder Octave

I am trying to move my project from matlab to octave and I have a question. In the file arduino.m of matlab I have added this part to take the reading and to be able to restart the encoder and I do not know if it would be necessary to pass it to the file below so that in octave it does not give me error or should I use “Arduino Rotary Encoder Functions” from octave .
Best regards.

classdef arduino < handle
    
   
    
    properties (SetAccess=private,GetAccess=private)
        aser   % Serial Connection
        pins   % Pin Status Vector
        srvs   % Servo Status Vector
        mspd   % Motor Speed Status
        sspd   % Servo Speed Status
        mots   % Motor Server Running on the Arduino Board
    end
    
    methods
        
        
        %%%%%%%%%%%%%%%%Introducido %%%%%%
        
        % Lectura de ENCODER
        function val=e(a)
            fwrite(a.aser,[58 0],'uchar');
            val=fscanf(a.aser,'%d');
        end % lectura de encoder
        
         % Reseteo contador encoder
        function val=reset_contador(a)
            fwrite(a.aser,[59 0],'uchar');
        end % lectura de encoder
            
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

file inicializa.m

global SIMULACION; 
global posicion; 
if SIMULACION == 0 %Asignación de pines a.pinMode(4,'OUTPUT'); 
  a.pinMode(10,'OUTPUT'); 
  %Puesta a cero de la salida 4 y 10 
  a.digitalWrite(4,0);
   a.analogWrite(10,0); 
  %Reseteo contador de encoder a.reset_contador; 
  %Conversión pulsos/ángulo 
  posicion=[a.e*.18*(2*pi/360)]; 
else
  posicion=[0];
end

If you are using an encoder connected to the arduino, use the octave arduino functions