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 8702241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:36:15+00:00 2026-06-13T02:36:15+00:00

I am pulling financial data into Matlab from SQL, where it is unfortunately stored

  • 0

I am pulling financial data into Matlab from SQL, where it is unfortunately stored as a ‘Real’ (which is an approximate data-type).

For example, a value got loaded into SQL as “96.194” which is the correct value (this could have any number of decimals 1-5). I know in SQL it is stored as something like 96.19400024 because it is an approximation, but SQL Server somehow knows to display it as 96.194.

When I pull it into matlab, it gets pulled in as 96.194, which is what I want. Unfortunately, it turns out it’s not actually 96.194, as demonstrated:

>>price
price =
           96.194

>> price==96.194
ans =
     0

>> class(price)
ans =
single

>> double(price)
ans =
          96.1940002441406

So my question is, is there a way to convert a single to a double exactly as it appears as a single (i.e. truncate all the decimals which are the approximation? Note: I cannot just round it because I don’t know how many decimals it’s supposed to have.

  • 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-06-13T02:36:17+00:00Added an answer on June 13, 2026 at 2:36 am

    The vpa function lets you specify a number of significant (nonzero) digits that is different from the current digits setting. For example:

    vpa(price, num_of_digits_required)
    

    or in your case:

    vpa(double(price),7)
    

    (6 or 8 significant digits will yield the same result)

    Edit

    To use vpa you’ll need the Symbolic Math Toolbox, there are alternatives found on the web, such as this FEX file.

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

Sidebar

Related Questions

I am currently pulling data from one of my SQL Databases into my application.
I am pulling data from a sql server and putting it into a grid
We are pulling a huge data from sql server DB. It has around 25000
Pulling some data from MongoDB and inserting it into a MySQL database, using Python
I have a query pulling the last six months of data from a table
Im pulling some data from an xml on a separate site and trying to
Im pulling some data out of my webdb, turning it into html and wanting
I am pulling a flat hash of parameters from an external API into my
Im pulling a date from a database which is formatted like dd-mm-YYYY. What I
Im pulling in xml data from the output of a php script. The way

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.