MATLAB 2022b removing spaces from strings in concatenation?

조회 수: 8(최근 30일)
I just tried to plot this but the space after Nozzle Number is being removed?
for i=1:19
plot(pressures_spray_angle,spray_angle(i,:),'-*','LineWidth',2,'DisplayName',strcat('Nozzle Number ',num2str(nozzle_numbers(i))));
Also I tried to concatenate with a + and that did not work.
Is this a MATLAB 2022b thing? If so, please name out the software engineer who implemented it and approved it for accountability purposes :D
  댓글 수: 2
Tahsin Emir Ersoy
Tahsin Emir Ersoy 2022년 11월 29일
you are right on this one, my bad.

댓글을 달려면 로그인하십시오.

채택된 답변

Jonas 2022년 11월 29일
편집: Jonas 2022년 11월 29일
"For character array inputs, strcat removes trailing ASCII whitespace characters: space, tab, vertical tab, newline, carriage return, and form feed. For cell array and string array inputs, strcat does not remove trailing white space."
use [] or horzcat please
tx1='hello ';
tx2='world ';
[tx1 tx2 num2str(number)]
ans = 'hello world 0.021847'
ans = 'hello world 0.021847'
ans = 'helloworld0.021847'
using + is only suported for strings not character arrays:
"hello " + "world"
ans = "hello world"
class("hello " + "world")
ans = 'string'
ans = 'char'
  댓글 수: 3
Tahsin Emir Ersoy
Tahsin Emir Ersoy 2022년 11월 29일
Just accepted, thanks again.

댓글을 달려면 로그인하십시오.

추가 답변(0개)


Find more on File Operations 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!

Translated by