displaying text before answer
    32 ビュー (過去 30 日間)
  
       古いコメントを表示
    
So I made a function on matlab but i want matlab to display 'the answer is' text and then the answer . How am I suppose to do that? I think I have to use disp code but I couldn't figure how. 
0 件のコメント
回答 (2 件)
  Walter Roberson
      
      
 2019 年 11 月 10 日
        
      編集済み: Walter Roberson
      
      
 2019 年 11 月 10 日
  
      Use fprintf() using a format that does not end in \n if you want to display something without going to the next line after.
0 件のコメント
  Sarvesh Kale
    
 2023 年 3 月 9 日
        refer to the following code 
x = 3.14 ;
fprintf("The value of pi is %f \n",x); % this will print the answer in your required format 
I hope this helps 
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


