Error with mobiledev object;
18 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi:
clc
clear
mobiledevlist
m=mobiledev;
delete(m);
clear mobiledev;
this is my code , in mobiledevlist it shows i have been connected with my device ,but i can find any object to get data from it ,
when run at "m=mobiledev",it occurs "Connection to this device already exists in the workspace."
did it occur by my device status is Connected ?

Thanks !
0 Commenti
Risposta accettata
Hitesh
il 12 Mag 2025
Hi 政博,
I'm not sure why you're still encountering this error even after removing the "mobiledev" object from the workspace. Start a fresh MATLAB session so that there won't be any existing object of "mobiledev" in the memory.To resolve the issue, please try deleting the object at the end of your script. B
If you are creating the "mobiledev" object as follows
m=mobiledev;
then, after using the object for your subsequent operations at the end of the script, add the below command to delete the object.
delete(m);
This will help us to destroy the object and the existing connection. Then, it will not be required to reopen MATLAB session.
clear all;
Please do let me know in case the issue persist.
4 Commenti
Hitesh
il 15 Mag 2025
Modificato: Hitesh
il 15 Mag 2025
Hi Walter,
You’re correct that the documentation mentions using "clear" on the mobileDev() object. However, I suspected that calling "clear" doesn’t actually delete the object, which is why we were seeing the error: "Connection to this device already exists in the workspace." I checked the MATLAB documentation and found that the object can be deleted using the "delete" function.
Più risposte (1)
Aastha
il 12 Mag 2025
According to the documentation of "mobiledev", the command
m = mobiledev
is used to create a mobiledev object "m". To get data from the object, Enable the "Logging" property of "mobiledev" object using the MATLAB command:
m.Logging = 1
This starts the transmission between the object and MATLAB.
For further queries, kindly refer to the MathWorks documentation of "mobiledev" linked below:
I hope this is helpful!
1 Commento
Walter Roberson
il 15 Mag 2025
Sadly, the documentation for mobiledev() does not include any information about how to remove the object.
By examining https://www.mathworks.com/help/releases/R2021a/matlabmobile/ug/sensor-data-streaming-tutorial.html or https://www.mathworks.com/help/releases/R2021a/matlabmobile/ug/use-logged-sensor-data.html we see that the way to remove the object is not delete() of the object, but is instead to "clear" the object.
Vedere anche
Categorie
Scopri di più su Sensor Data Collection in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!