필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Help needed in frintf statement with if condition I have attached my code below

조회 수: 1 (최근 30일)
Rakesh Yadav Kodari
Rakesh Yadav Kodari 2019년 5월 9일
마감: MATLAB Answer Bot 2021년 8월 20일
if (ramps == 1)
rampChar = 0;
downChar = 0;
elseif (ramps == 2)
rampChar = 1;
downChar = 0;
end
if (ADCsamples == 1024)
disp("Configure number of samples 1024...");
fprintf(t,'%s\r\n',['!BB034 num2str(downChar) num2str(rampChar) EC']);
disp("Base Band Setup Configuration is done");
elseif (ADCsamples == 512)
disp("Configure number of samples 512...");
fprintf(t,'%s\r\n',['!BB034 num2str(downChar) num2str(rampChar) E5']);
disp("Base Band Setup Configuration is done");
end
I need the downchar and rampchar values go directly to fprintf.
but its not working.
Can anyone help please.

답변 (1개)

Cam Jones
Cam Jones 2019년 5월 15일
It looks like you have not closed out the quotes in your character arrays.
Specifically looking at
fprintf(t,'%s\r\n',['!BB034 num2str(downChar) num2str(rampChar) E5']);
There is a single quote at the start of the 3rd argument and it is not closed until the end.
When building character arrays in MATLAB, you would want to close out the raw characters before a function call.
fprintf(t,'%s\r\n',['!BB034' num2str(downChar) num2str(rampChar) 'E5']);

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by