This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

MATLAB Integration
#1
I am trying to use MATLAB to pull data from phyphox. I am trying to access this data every 20 seconds and to write over the previously stored data each time. This is the code that I wrote. When I run the code, it works, but the data that is collected is the same each time, which leads me to believe that I am not pulling the correct information. Am I using the wrong key words to get the information?

% remote access address
phyphox_address_home = 'IP';

% starts data collection in phyphox
start = webread('IP/control?cmd=start');

% initial data pull
address = sprintf('%sexport?format=0/get?gyr_time=0&gyrX|gyr_time&gyrY|gyr_time&gyrZ|gyr_time',phyphox_address_home);
GyroscopeData = webread(address)

% waits 5 seconds, then pulls data again
pause(5)

% pulls data every 20 seconds, writes over previous data
for i = 1:10
    time = 20*i;
    address = sprintf('%sexport?format=0/get?gyr_time=%d&gyrX|gyr_time&gyrY|gyr_time&gyrZ|gyr_time',phyphox_address_home,time);
    GyroscopeData = webread(address)
    pause(20)
end

% stops phyphox
stop = webread('IP/control?cmd=stop');
Reply
#2
Not much experience with the MatLab part, but "export?format=0/get?..." is not a valid target or at least it is not what you intent to do.

/export returns an entire file in a specific format, usually meant to be stored or downloaded by the user. /export?format=0 specifically gives you an Excel file and I do not think that webread can handle this. Additionally, I am not sure how phyphox interprets the additional /get..., but it will probably default to Excel anyways.

/get returns data in JSON, which should be usable by "webread". Here you can specify the buffers you want to retrieve along with how much you want to get from that buffer. Your format for this is also a bit off (see https://phyphox.org/wiki/index.php/Remot...munication), but I am not entirely sure what you try to request here. I would suggest that you first try with /get?gyr_time=full&gyrX=full&gyrY=full&gyrZ=full. If this works, you can try adding the specific time from which you want to retrieve the data.
Reply


Forum Jump: