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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:26:20+00:00 2026-06-15T21:26:20+00:00

I have an array: step1 = [0,0; 0,1; 1,1; 2,3; 3,4; 3,5; 3,6; 3,7;

  • 0

I have an array:

step1 = [0,0;
         0,1;
         1,1;
         2,3;
         3,4;
         3,5;
         3,6;
         3,7;
         4,7;
         5,7;
         6,7;
         6,6;
         6,5;
         6,4;
         6,3;
         6,2;
         5,1];

I want to step through this array and create new arrays for the row and column that increment by 0.1 from one row to another. This is what I did:

z=1;
u=length(step1);
step_b4X = zeros(u,1);
step_b4Y = zeros(u,1);
while z <= length(step1)
    step_b4X = step_presentX;
    step_presentX(z,1) = step1(z,1);
    step_b4Y = step_presentX;
    step_presentY(z,1) = step1(z,2);
    pathX = step_b4X:0.1:step_presentX;
    pathY = step_b4Y:0.1:step_presentY;
    z = z+1;
end

I get zeros.
I want pathX = 0:0.1:0….pathY = 0:0.1:1
next pathX = 0:0.1:1….pathY = 1:0.1:1… and so on

  • 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-15T21:26:21+00:00Added an answer on June 15, 2026 at 9:26 pm

    If you do

    start:increment:end
    

    where start == end, you’ll get a scalar equal to start (which is logical).

    If you want pathX and pathY to have the same length at each iteration, you’ll have to do this:

    z = 1;
    while z <= length(step1)
    
        currentX = step(z,1);   nextX = step(z+1,1);
        currentY = step(z,2);   nextY = step(z+1,2);
    
        pathX = currentX : 0.1 : nextX;
        pathY = currentY : 0.1 : nextY;
    
        if numel(pathX) == 1
            pathX = repmat(pathX, numel(pathY),1); end
        if numel(pathY) == 1
            pathY = repmat(pathY, numel(pathX),1); end
    
        z = z+1;
    end
    

    Now you’ll have the right arrays at each iteration, that you’ll use directly or save in a cell-array for later. If you want everything in one big array, add this to the end of the loop:

        pathX_final = [pathX_final; pathX];
        pathY_final = [pathY_final; pathY];
    

    and initialize them as empty before the loop, of course.

    Alternatively (much cleaner and possibly a bit faster), ditch the whole loop and use interp1:

    x = step1(:,1);
    y = step1(:,2);
    
    xx = interp1(1:numel(x), x, 1:0.1:numel(x));
    yy = interp1(1:numel(y), y, 1:0.1:numel(y));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this array in PHP session, which I want to step through one
Say we have array of arrays: tree_limbs = Array.new tree_limbs << %w(1 2 3
I have an array in JavaScript that can go as deep as I want:
I have array like this: $path = array ( [0] => site\projects\terrace_and_balcony\mexico.jpg [1] =>
I have array result like this: Array ( [0] => stdClass Object ( [id_global_info]
I have an array with a series of event IDs organized like this: $event['year']['month']['day']
I am trying to make this function that extracts text from html for multiple
So currently I have an array with smarty.. {foreach from=$_sequences key=k item=v} Name =>
Is it possible to have an array that contains two different types of data?
I have .txt files that contain the output from a data logger. The data

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.