phyphox Forums

Full Version: MATLAB Integration
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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

% 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)

% stops phyphox
stop = webread('IP/control?cmd=stop');
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, 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.