Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

MATLAB num2str

  1. Aug 13, 2008 #1
    Hi all,
    I am converting a double to a string. But in the following case:
    format long
    when 'numnum' is converted to a string, the command truncates the number by leaving off the last digit, the zero. Is there a way to keep the zero on there when converting to a string?
  2. jcsd
  3. Aug 15, 2008 #2


    User Avatar
    Science Advisor
    Gold Member

    Yes, specify the format as a floating point number
    or use one of the other formats (scientific notation, etc.) listed in the Help manual. Check the Help entry for num2str and you'll see a clickable link to the format list.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook