change of variable

조회 수: 1 (최근 30일)
Baba
Baba 2011년 11월 3일
I asked this question before but I missed an important point:
I would like to be able to Change 'X7' . I don't want to Do anything with the "X" because I have Y7, Z7,K7 in other plots. Basically I just want to be able to change the digit "7" and not the letters.
Here is my code:
subplot(3,2,1)
Hs=spectrum.periodogram;
psdest = psd(Hs,X7,'Fs',Fs);
semilogx(psdest.Frequencies,10*log10(psdest.Data));
grid on;
xlabel('Frequency (Hz)')
ylabel('dB/Hz')
title('X7')
  댓글 수: 3
Fangjun Jiang
Fangjun Jiang 2011년 11월 3일
If you read the answers to your previous same question, both answers provide valid solution.
Walter Roberson
Walter Roberson 2011년 11월 3일
The previous answers were at http://www.mathworks.com/matlabcentral/answers/20170-change-variable-name

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

채택된 답변

Walter Roberson
Walter Roberson 2011년 11월 3일
Perhaps the answer being looked for here is a variation of Fangjun's earlier answer.
N = 7;
Str = sprintf('X%d', N);
psdest = psd(Hs,eval(Str),'Fs',Fs);
title(Str);
  댓글 수: 1
Baba
Baba 2011년 11월 3일
Yes, thanks for this

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Grid Lines, Tick Values, and Labels에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by