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

  • Home
  • SEARCH
  • 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 1101513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:02:49+00:00 2026-05-17T01:02:49+00:00

i successfully integrated my .NET Dll into MATLAB. Everything is good. But, i pass

  • 0

i successfully integrated my .NET Dll into MATLAB. Everything is good. But, i pass a System.Double with value like 6000.46, and return it in a MATLAB function as [valueFromDotNet]
the ans of MATLAB is ans = 6000, but i expected at least ans = 6000.4600
has anybody an idea where i have to look?

EDIT 1:
I ensured that the format is short. (if get(0,’Format’)) and i also set the format long;
Nothing has changed. Anybody an idea why this is happening.

EDIT 2:
found the problem. I receive the data that i feed into MATLAB from an external service. the numbers there are formated as string, but always as “6000.46”; i parsed with CultureInfo.InvariantCulture, but that seemed to be wrong. Changed it to new CultureInfo(“en-US”), and it works now!

EDIT 3:
i was too excited. it’s still stange. but i think it’s now just a not knowing how mathlab works

i have this callback

function tbmxHandleTickEvent(source,arg)
   t = arg.Tick;
   [t.BidPrice t.AskSize t.AskPrice t.LastSize t.LastPrice]
end

the callback gets triggered by an .NET event
using this, i get the prices values without the fraction

when i change the callback like this

function tbmxHandleTickEvent(source,arg)
   t = arg.Tick;
   t.BidPrice
end

the result is this price including the fraction

  • 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-17T01:02:50+00:00Added an answer on May 17, 2026 at 1:02 am

    What might be happening is that one of those other values coming back is an integer type and that’s causing the double to get converted when you concatenate them. Unlike most other programming languages, when combining floating point and integer types, Matlab will narrow the floating point (double) values to the integer types instead of widening the ints.

    Here’s an example in R2009b.

    >> x = [6000.46 int32(1)], class(x)
    x =
            6000           1
    ans =
    int32
    >> 
    >> 6000.46 + int32(1)
    ans =
            6001
    

    You can diagnose this, at least for concatenation, by enabling the warning for this lossy conversion. Try doing that and rerunning your code.

    >> warning on MATLAB:intConvertNonIntVal
    >> x = [6000.46 int32(1)]
    Warning: Conversion rounded non-integer floating point value to nearest int32 value. 
    x =
            6000           1
    >> 
    

    If this is what’s going on, you should explicitly convert all the int values in arg.Tick to double. Maybe by extracting arg.Tick to a struct and converting while you step through the fields.

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

Sidebar

Related Questions

I have successfully integrated twitter's Oauth into my app, but anybody have an idea
So I've successfully integrated Facebook into my Wordpress site. I've also linked together the
I successfully integrated iAd into my iPhone app. However, I can't find a way
I installed uppercut in my system successfully, Then i installed cc.net, for automated build
So I have successfully integrated Zxing into my application. However I want to make
I have successfully integrated the Silent Post feature with our system for ARB subscriptions.
I successfully integrated a FaceBook application into my project (the regular FaceBook page where
I have successfully integrated PayPal Express into a Flex application. In DoExpressCheckoutPayment.php, I have
I have successfully integrated PayPal. All is working fine. But I want my form
I successfully integrated inapp purchase in my application. But I left with a doubt

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.