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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T00:02:18+00:00 2026-05-20T00:02:18+00:00

I have variables which are of double type I want them to be float

  • 0

I have variables which are of double type I want them to be float. Is there a way to force a variable to be float and not double, also, Is there a way to do it in some global way for all functions and sub functions with few lines at the start of the main function? I have many functions and they use many temporary variables and create variables that they return. Going over all of my functions and changing them will be very difficult.

My rational for this request:

I’m writing the MATLAB program in order to simulate an algorithm which I’ll then implement in hardware, I want to make sure that using 32bit as the size of my signals will not cause calculation errors.

  • 1 1 Answer
  • 2 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-20T00:02:18+00:00Added an answer on May 20, 2026 at 12:02 am

    Using B=single(A) as suggested by @cbz, or defining arrays as SINGLE, such as by calling B=zeros(3,3,'single') creates “floats” in Matlab.

    There is no way to globally turn Matlab into a “float” environment. Although most lower-level functions are implemented for single as well (with a few exceptions, for example those mentioned in the help to DOUBLE), many high-level builtin functions will only work with double.

    In other words, you’ll have to manually define your variables as single, you’ll have to periodically check that the variables haven’t been quietly converted to double, and in the end, your code might not work if it needs a function that isn’t implemented for single yet.

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

Sidebar

Related Questions

I have several variables of type char (array), int, and double. Is there a
In a C++ code I have a matrix of double variables which I print
I have a php file which has some variables like $name1, $name2... How can
I have a url which has some get variables in it like: domain.com/recover?email=my@email.com&token=abc123 inside
I have a variable that contains an integer which I then want to save
I have some DateTime variable, and I want to use System.Threading.Timer to wait until
I want to basically have an id type in Oracle. An example which would
I have two string variables which are both file paths. The code that worked
I have been looking at LESS ( http://lesscss.org/ ) which adds variables and macro
I have global static variables in a C library, which generate exceptions in a

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.