How to concatenate an array?
1 view (last 30 days)
Show older comments
Luis Ricardo Rivera Goitia
on 29 Mar 2023
Commented: Luis Ricardo Rivera Goitia
on 10 Apr 2023
I have an array that is receiving data from the cloud, and I'm loosing the initial data while the array continue receiving the data.
How can I concatenate the data to keep the initial data in the array while continue receiving new data?
Here's the code and the array as a reference.
while true
dataTT = (read(MQTTSignal));
str = dataTT.Data;
str = strrep(str, '{', ''); % remove opening bracket
str = strrep(str, '}', ''); % remove closing bracket
str = split(str,",");
current = str2double(str(:,1));
speed = str2double(str(:,2));
time = str2double(str(:,3));
subplot(2,1,1);
plot(time,current);
ylim([0,150]);
grid ON
title("Current");
subplot(2,1,2);
plot(time,speed);
ylim([0,1000]);
grid ON
title("Speed");
drawnow
pause(3)
end
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Data Type Conversion in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!