Can you do the writeline function without the added terminator?
I know that the writeline function adds the ‘n’ terminator at the end of a string, but I was wondering if there was a way to write strings without the terminator. Lets look at the following example:
s = serialport(‘COM7’, 9600); % Open the serial port
choice = randi(2);
if choice == 1
writeline(s, "Bananas ");
elseif choice == 2
writeline(s, "Apples ");
end
writeline(s, "are good");
delete(s);
Notice how the intended output could either be "Bananas are good" or "Apples are good". However in practice, it becomes "Bananas
are good" or "Apples
are good". Is there any way to just stop this terminator from even activating?I know that the writeline function adds the ‘n’ terminator at the end of a string, but I was wondering if there was a way to write strings without the terminator. Lets look at the following example:
s = serialport(‘COM7’, 9600); % Open the serial port
choice = randi(2);
if choice == 1
writeline(s, "Bananas ");
elseif choice == 2
writeline(s, "Apples ");
end
writeline(s, "are good");
delete(s);
Notice how the intended output could either be "Bananas are good" or "Apples are good". However in practice, it becomes "Bananas
are good" or "Apples
are good". Is there any way to just stop this terminator from even activating? I know that the writeline function adds the ‘n’ terminator at the end of a string, but I was wondering if there was a way to write strings without the terminator. Lets look at the following example:
s = serialport(‘COM7’, 9600); % Open the serial port
choice = randi(2);
if choice == 1
writeline(s, "Bananas ");
elseif choice == 2
writeline(s, "Apples ");
end
writeline(s, "are good");
delete(s);
Notice how the intended output could either be "Bananas are good" or "Apples are good". However in practice, it becomes "Bananas
are good" or "Apples
are good". Is there any way to just stop this terminator from even activating? serial, arduino MATLAB Answers — New Questions