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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:23:12+00:00 2026-05-14T15:23:12+00:00

ok it seems like a simple problem, but i am having problem I have

  • 0

ok it seems like a simple problem, but i am having problem
I have a timer for each data set which resets improperly and as a result my timing gets mixed.
Any ideas to correct it? without losing any data.
Example

timer col ideally should be

timer , mine reads
1 3
2 4
3 5
4 6
5 1
6 2

how do i change the colum 2 or make a new colum which reads like colum 1 without changing the order of ther rows which have data
this is just a example as my file lengths are 86000 long , also i have missing timers which i do not want to miss , this imples no data for that period of time.

thanks

EDIT: I do not want to change the other columns. The coulm 1 is the gps counter and so it does not sync with the comp timer due to some other issues. I just want to change the row one such that it goes from high to low without effecting other rows. also take care of missing pts ( if i did not care for missing pts simple n=1: max would work.

missing data in this case is indicated by missing timer. for example i have 4,5,8,9 with missing 6,7

Ok let me try to edit agian
its a 8600x 80 matrix of data:
timer is one row which should go from 0 to 8600
but timer starts at odd times , so i have start of data from middle , lets say 3400, so in the middle of day my timer goes to 0 and then back to 1.
but my other rows are fine. I just need 2 plot other sets based on timer as time.
i cannot use T= 1:length(file) as then it ignores missed time stamps ( timers )

for example my data reads like

timer , mine reads
1 3
2 4
3 5
4 8
5 9
8 1
9 2

so u can see time stamps 6,7 are missing.
if i used n=1:length(file)
i would have got
1 2 3 4 5 6 7
which is wrong
i want
1 2 3 4 5 8 9

without changing the order of other rows , so i cannot use sort for the whole file.

  • 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-14T15:23:13+00:00Added an answer on May 14, 2026 at 3:23 pm

    I assume the following problem

    data says

    3 100
    4 101
    5 102
    NaN 0
    1 104
    2 105
    

    You want

    1 100
    2 101
    3 102
    NaN 0
    4 104
    5 105
    

    I’d solve the problem like this:

    %# create test data
    data = [3 100
        4 101
        5 102
        NaN 0
        1 104
        2 105];
    
    %# find good rows (if missing data are indicated by zeros, use 
    %# goodRows = data(:,1) > 0;
    goodRows = isfinite(data(:,1));
    
    %# count good rows
    nGoodRows = sum(goodRows);
    
    %# replace the first column with sequential numbers, but only in good rows
    data(goodRows,1) = 1:nGoodRows;
    
    data =
    
         1   100
         2   101
         3   102
       NaN     0
         4   104
         5   105
    

    EDIT 1

    Maybe I understand your question this time

    data says

    4 101
    5 102
    1 104
    2 105
    

    You want

    1 4 101
    2 5 102
    4 1 104
    5 2 105
    

    This can be achieved the following way

    %# test data
    data = [4 101
        5 102
        1 104
        2 105];
    
    %# use sort to get the correct order of the numbers and add it to the left of data
    out = [sort(data(:,1)),data]
    
    out =
    
         1     4   101
         2     5   102
         4     1   104
         5     2   105
    

    EDIT 2

    Note that out is the result from the solution in EDIT 1

    It seems you want to plot the data so that there is no entry for missing values. One way to do this is to make a plot with dots – there won’t be a dot for missing data.

    plot(out(:,1),out(:,3),'.')
    

    If you want to plot a line that is interrupted, you have to insert NaNs into out

    %# create outNaN, that has NaN-rows for missing entries
    outNaN = NaN(max(out(:,1)),size(out,2));
    outNaN(out(:,1),:) = out;
    
    %# plot
    plot(out(:,1),out(:,3))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 380k
  • Answers 380k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Test whether the object pointer is nil: if (theObject !=… May 14, 2026 at 9:53 pm
  • Editorial Team
    Editorial Team added an answer "Minus 7 hours" is equal to "minus 1 day, plus… May 14, 2026 at 9:53 pm
  • Editorial Team
    Editorial Team added an answer Where do I do input validation (ie. proper email address… May 14, 2026 at 9:53 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.