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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:58:14+00:00 2026-06-14T08:58:14+00:00

I am using interp1 to inteprolate some data: temp = 4 + (30-4).*rand(365,10); depth

  • 0

I am using interp1 to inteprolate some data:

temp = 4 + (30-4).*rand(365,10);
depth = 1:10;

dz = 0.5; %define new depth interval
bthD = min(depth):dz:max(depth); %new depth vector

for i = 1:length(temp);
    i_temp(i,:) = interp1(depth,temp(i,:),bthD);
end

Here, I am increasing the resolution of my measurements by interpolating the measurements from 1 m increments to 0.5 m increments. This code works fine i.e. it gives me the matrix I was looking for. However, when I apply this to my actual data, it takes a long time to run, primarily as I am running an additional loop which runs through various cells. Is there a way of achieving what is described above without using the loop, in other words, is there a faster method?

  • 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-14T08:58:16+00:00Added an answer on June 14, 2026 at 8:58 am

    Replace your for loop with:

    i_temp = interp1(depth,temp',bthD)';
    

    You can get rid of the transposes if you change the way that temp is defined, and if you are OK with i_temp being a 19×365 array instead of 365×19.

    BTW, the documentation for interp1 is very clear that you can pass in an array as the second argument.

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

Sidebar

Related Questions

using Telerik.WinControls.Data; using Telerik.WinControls.UI.Export; namespace Directory { public partial class radForm : Form {
@using(Html.BeginForm(About, User, FormMethod.Post , new { id=aboutme})) { <fieldset> <ul> <li> <label class=block>About me</label>
Using Android TelephonyManager an application can obtain the state of data activity over the
I am using the interp1 function to resample (a,b) to (new_a, new_b). I get
I have done some work in Python, but I'm new to scipy . I'm
Using C# .NET 3.5 and WCF, I'm trying to write out some of the
Using C# and System.Data.SqlClient, is there a way to retrieve a list of parameters
Using the Exiv2 library to write some exif tags to an image i'm running
Using a CSS image sprite, I'm creating an 'interactive' image where hovering over certain
Using a populated Table Type as the source for a TSQL-Merge. I want to

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.