필터 지우기
필터 지우기

Combining two strings

조회 수: 12 (최근 30일)
Jared
Jared 2011년 10월 15일
I'm using uigetfile to get the path and file name of a data file which enables me to use the load command to import the data. For example, say the file is named channel1.txt.
Inside the multi-column data file is a column that has receiver number. I save that receiver number as a string, we'll say it is 1.
When I plot the data, I want the legend to say "Rx 1 channel1.txt". Currently I just am doing legend(filename1) which would show "channel1.txt." How can I combine all of these strings to 1 legend label?

채택된 답변

Wayne King
Wayne King 2011년 10월 15일
plot(randn(100,1));
filename = 'channel1.txt';
Rx = 'Rx 1';
legend([Rx filename]);
% or
legend(strcat(Rx,filename));

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Legend에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by