Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

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

1 visualización (últimos 30 días)
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.

Respuestas (1)

Cam Jones
Cam Jones el 15 de Mayo de 2019
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']);

La pregunta está cerrada.

Community Treasure Hunt

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

Start Hunting!

Translated by