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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:04:49+00:00 2026-06-15T06:04:49+00:00

My problem is to import numbers inside CSV file to matlab variable with the

  • 0

My problem is to import numbers inside CSV file to matlab variable with the same precision as original number. Here’s an example of my data (there can be X amount of rows with one header on top of file):

g_B_esti_Velx, g_B_Velx, g_B_ACCx, g_B_esti_Vely, g_B_Vely, g_B_ACCy, g_B_esti_Velz, g_B_Velz, g_B_ACCz, ControlPitch, AnglePitch, ControlRoll, AngleRoll, Controlyaw, AngleYaw, Controlthrust, g_throttle, msgbatteryVoltage, msgcurrent, msgcapacity_mAh, time, index, tracking, detected
-0.266192,-1.072520,0.788713,0.163473,0.623330,-0.333946,0.000000,-0.773519,0.451613,7,-0.050615,0,-0.017453,0,-0.331613,128,472,142,97,2227,1340731788.614960,179,1,1
-0.270800,-0.486626,0.876130,0.125808,0.329368,-1.245129,0.000000,-0.459128,0.193548,40,-0.033161,-35,-0.017453,0,0.558505,128,472,142,99,2227,1340731788.715275,180,1,1

I have successfully imported data with import wizard and with following code. But the problem is that number import is only with double precision, which is not sufficient.

fid = fopen('mk-2012-6-26-19-29.csv');
mydata = textscan(fid,'%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s','Delimiter',',','CollectOutput',1);
fclose(fid);
mydata = [cellfun(@str2double,[mydata{1:end}])]';
whos mydata

and matlab import wizard result:

newData1 = importdata('mk-2012-6-26-19-29.csv');
for i = 1:size(newData1.colheaders, 2)  % variable count
    assignin('base', genvarname(newData1.colheaders{i}), newData1.data(:,i)); %limit range on first parameter with :
end

I’m using Matlab R2011a

  • 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-15T06:04:50+00:00Added an answer on June 15, 2026 at 6:04 am

    Problem seemed to only be with my Matlab display precision

    Following command allowed me to check this:

    >> format long
    >> time_mk(1,1)
    
    ans =
    
         1.340731788614960e+09
    

    Result matches the first row time variable on my question.

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

Sidebar

Related Questions

Here is a small program showing a problem: import Data.Fixed main = do print
Ok here is my problem. I have a csv file that is created out
The problem is during inserting data from staging table during import routine. The system
I have a problem using the SSIS. I try to import data from database
I have a problem refreshing a partial with fields_for inside. Here is the code
I have a problem with import of a 3D model into a WebGL shader
I met a problem when trying @Singleton of Guice: import com.google.inject.Singleton; @Singleton public class
I have a problem with 2D transformation program I have the source code import
I'm working with intelliJ and my problem is when I start to import some
I have a problem with Observer-Pattern and deadlock using threads. package observerDeadLock; import java.util.Observable;

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.