Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7077463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:25:35+00:00 2026-05-28T06:25:35+00:00

>> x = 14.021 >> num2str(x,’%4.5f’) I want to get this as a result:

  • 0
>> x = 14.021
>> num2str(x,'%4.5f')

I want to get this as a result:

0014.02100

But, MATLAB just answers me with:

14.02100
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T06:25:36+00:00Added an answer on May 28, 2026 at 6:25 am

    You should use sprintf. For example:

    x = 14.021
    sprintf('%010.5f', x)
    

    Note that you don’t need to use num2str.

    The first argument to sprintf is the format specifier which describes how the resulting text should be displayed. The specifier begins with %, the leading 0 tells sprintf to pad the string with zeros. Loosely, the .5 tells it to print five digits to the right of decimal point and the f tells it we want to format it like a floating point number.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to get substring from this string: 1,26,[1076168,'Stabaek','Brann','1.021',10,'08/07/2012 01:00','',0,0,1,6],,[[19,23,[]],[14148266,[1,0,1,0,5000,-0.50,19001],[-0.95,0.87]],[14166487,[1,0,1,0,2000,-0.25,19001],[-0.72,0.64]],[14148270,[5,0,5,0,2000,0.00,19001],[3.90,3.50,1.86]],[14166491,[1,0,1,0,3000,-0.75,19001],[0.80,-0.88]]],2 So I called swscanf
This removes all spaces: irb(main):021:0> 'gff gf ggfgfg '.gsub(' ','') => gffgfggfgfg but I
I have a file that reads like this 2012-021 24X7 Online Tutoring Company Applied
I need to validate an Irish phone number but I don't want to make
I am trying to make a currency value. >> 100.00 I tried this: irb(main):021:0>
I'm trying to replicate a UI similar to this: http://librixxxi.blogspot.com/2011/06/punch-clock-021-and-clickable-edit.html and I have been
I'm thinking to use Array to store this tiny data instead using Database. But,
I am sure this is really simple, but I'm missing something. This has always
I know I can use callbacks but this should be feasible. I did lengthly
I always get a Resources$NotFoundException but i don't know why. Please help Code: @Override

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.