www.gusucode.com > robotics 案例源码程序 matlab代码 > robotics/PutGetAndDeleteFilesOnAROSDeviceExample.m

    %% Put, Get, and Delete Files on ROS Device
% Put a file from your host computer onto a ROS
% device, get it back, and then delete it.

%%
% Connect to a ROS device. Specify the device address, user name, and
% password of your ROS device.
d = rosdevice('192.168.154.131','user','password');

%%
% Put a new text file that is in the MATLAB(R) current folder onto the ROS
% device. The destination folder must exist.
putFile(d,'test_file.txt','/home/user/test_folder')

%%
% Get a text file from the ROS device. You can get any file, not just
% ones added from MATLAB(R). By default, the file is added to the MATLAB current
% folder.
getFile(d,'/home/user/test_folder/test_file.txt')

%%
% Delete the text file on the ROS device.
deleteFile(d,'/home/user/test_folder/test_file.txt')