MATLAB: How to display text in a plot as scientific number MATLABplottext; How do I display a very small/large number in text command as a number with 2 digits after the decimel point? e.g. 5.42e-6 rather than 0.00000542 or 5.4200e-06 thanks, Ziv Best Answer Use a format string to create specific format desired...>> sprintf('%.2e',pi*1E6)ans = '3.14e+06'ergo, usetext(x,y,sprintf('%.2e',valueToPrint)) There's also num2str, compose that have some additional flexibility for specific uses... Related SolutionsMATLAB: Write a getString() function that prompts the user for a string and returns it function str = getstring()str = input('Enter A String: ','s');end MATLAB: Next line, new line! in the text( ) code Try sprintf:message = sprintf('Line #1\nThe second line.\nAnd finally a third line.');plot(1:20);text(5, 5, message, 'FontSize', 20, 'Color', [.6 .2 .6]); Related QuestionAnd how can i fix the vert cat error in this code? It works fine with a 3 len string but over that i get a vert cat error
Best Answer