MATLAB: Using text, 2 variables, and decimals in fprintf fprintf fprintf(["The value you entered "+'%.1f°C\n',temp + "is equal to "+'%.1f°F\n',ans]) Can someone help me make this line work. I feel like I'm close but I keep getting errors. Best Answer Try this: fprintf("The value you entered %.1f°C\nis equal to %.1f°F\n", temp, ans)so: temp = 10;ans = 50;fprintf("The value you entered %.1f°C\nis equal to %.1f°F\n", temp, ans)produces: The value you entered 10.0°Cis equal to 50.0°FTo get it all on one line, replace the first ‘\n’ with a space: fprintf("The value you entered %.1f°C is equal to %.1f°F\n", temp, ans)producing: The value you entered 10.0°C is equal to 50.0°F. Related SolutionsMATLAB: How can do this n = [];while 1 x = input('Enter a positive number: ') if x < 0 % or <= ? break; end n = [n, x];endfprintf('Total positive numbers is %f\n', numel(n))fprintf('The sum is %f\n', sum(n)) MATLAB: How to use the value of L and fprintf function in the ‘syms’ You should change exp1=('x+y-L'); exp2=('(x/4)+y-(L/2)');to exp1 = x+y-L; exp2 = (x/4)+y-(L/2);You cannot fprintf() a symbolic value, but you can probably fprintf() double(x) and double(y) Related QuestionNot providing a fixed inputHow do you finish this for loop? It is telling me to define the variable “total”, but what do I put in order for it to flow with the loop
Best Answer