How to display a result
Show older comments
Hi,
How to print a statement which has two variables.,for eg., h is the input for the function and f is the output value.
h=[50 100]
f = 149
f = 151
I can write, fprintf( 'The value of f is = %.2f\n ',f ) which displays two statements.
But I want to print a statement 'The value of f at h is = ?'. (The value at h1 is : 149, the value of h2 is 151)
5 Comments
It's not clear what exactly do you want. Is it like this -
h=[50 100];
f=[149 151];
fprintf( 'The value of f at h1 is : %d, The value of f at h2 is : %d',f)
Chinmayraj Doddarajappa
on 14 Jul 2022
Edited: Torsten
on 14 Jul 2022
Torsten
on 14 Jul 2022
See above.
Chinmayraj Doddarajappa
on 14 Jul 2022
h=[10 20 30];
f=h.^3+2*h-h.^2;
fprintf('The frequency at %d m is: %f\n',[h;f])
Accepted Answer
More Answers (0)
Categories
Find more on Get Started with MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!