readRegister function undefined when used in GUIDE
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Christopher Gates
el 24 de Abr. de 2019
Comentada: Christopher Gates
el 24 de Abr. de 2019
Hi All,
I'm a hobbyist attempting to create a basic gui that will sample data from an I2C based current sensor that is attached to my raspberry pi. I have written and successfully tested a class that correctly samples this data when run via a standard Matlab Script. However, when I attempt to code this into a gui, I get the following error message when I try to call the readRegister function:
Undefined function 'readRegister' for input arguments of type 'double'.
From doing research, I believe that matlab somehow cannot locate the readRegister function when called from the gui. This confuses me since the function easily runs if I simply call it from the command line, for example this works outside of the gui:
config_values = readRegister(sensor.i2cLink,register_address,'uint8',2);
where sensor.i2cLink and register_address are specifically defined (and verified to exist when debugging).
Does anyone know of a work around to this?
0 comentarios
Respuesta aceptada
Walter Roberson
el 24 de Abr. de 2019
readRegister requires an object of class device but inside your GUI you are instead passing it an object of class double. In particular you should check sensor.i2cLink to see if it is [], the empty array, such as if the link configuration had not been done yet or had failed.
Más respuestas (0)
Ver también
Categorías
Más información sobre GenICam Interface en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!