Reading from named FIFO on Linux
显示 更早的评论
I am trying to read from a named fifo in the /tmp/ folder on the linux file system. I have one fifo which sends data to another named fifo and is recieved by a c++ program. Now I need to do that in reverse but I am struggling to recieve any data in MATLAB. I have some test code built in to my main matlab program at the point which the file needs to be read:
disp('Trying to read')
formatSpec = '%s %s';
count = 1;
while 1
disp(count)
A1 = fscanf(fileID_slam,formatSpec);
A2 = textscan(fileID_slam,formatSpec);
disp(A1)
disp(A2)
count = count + 1;
end
Assume the pipes were correctly setup.
What happens is it reaches disp(count) and then blocks until the c++ program ends and then loops infinitely reading [0x1] matrices and the current count value.
The C++ code is simply a loop which does the following:
pipe << test_num << std::endl;
pipe.flush();
test_num++;
If anyone has any advice on the best reading function to use in MATLAB for this situation or any reason why the read function might be blocking I would really appreciate it.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Use Prebuilt MATLAB Interface to C++ Library 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!