bug in sprintf 2024a, can't use other variable and just repeating the first variable
Show older comments
this is the code that spoiled my food, I've been following this tutorial and I got stuck at this one for TWO HOURS! I can't use the second variable!
Nume = app.NumeratorEditField.Value;
Domi = app.DenominatorEditField.Value;
[r,p,k] = residue(Nume,Domi); % this is for partial fraction
r1 = real(r) %I am trying to seperate the real # from the imaginary number (complex)
r2 = imag(r) %I am trying to seperate the real # from the imaginary number (complex)
app.rTextArea.Value = sprintf('%g + %gi\n',r1, r2) %this is where I am stuck
%%% Instead of giving me the result:
0.23123 + -1.123123i
0.344 + 1.7766i
0.234 + 0.00251234i
%%% It is giving me this:
0.23123 + 0.23123i
0.344 + 0.344i
0.234 + 0.234i
-1.123123 + -1.123123i
1.7766 + 1.7766i
0.00251234 + 0.00251234i
Take note about the bold&italic numbers this might be clue ;(
PLEEASE HELP ME PASSED THIS COURSE ToT
Accepted Answer
More Answers (0)
Categories
Find more on Data Type Conversion in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!