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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:45:39+00:00 2026-06-05T00:45:39+00:00

Suppose I have a cell array with 3 elements; the first and third cells

  • 0

Suppose I have a cell array with 3 elements; the first and third cells are matrices, while the second is empty:

>> P
P = 
  [3x8 double]    []    [3x8 double]

I can fill in the second matrix by interpolating for every individual element in the matrix, but surely there must be a way to do this in one shot?

EDIT: An average would certainly work for P. But suppose I have something like

>> Q
Q = [3x8 double]    [3x8 double]     [3x8 double]    []    []    [3x8 double]

So given my four known matrices, I could use a fancier interpolation (like spline) to fill in the missing matrices.

  • 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-05T00:45:40+00:00Added an answer on June 5, 2026 at 12:45 am

    You can perform all the interpolation in a single function call to INTERP1, but it requires setting the data into the desired shape, then back once done:

    %# cell array of matrices (some are missing)
    sz = [3 8];         %# all of same size
    Q = {ones(sz), [], 3*ones(sz), [], [], 6*ones(sz)};
    
    %# indices of missing matrices
    idx = ~cellfun(@isempty,Q);
    x = 1:numel(Q);
    
    %# merge cells into a multidimensional matrix, call INTERP1, then divide back
    QQ = Q(idx);
    QQ = permute(cat(3,QQ{:}), [3 1 2]);
    QQ = interp1(x(idx), QQ, x);            %# one call to interpolation function
    QQ = reshape(num2cell(permute(QQ, [2 3 1]), [1 2]), 1,[]);
    

    Just keep in mind that vectorization sometimes comes at the cost of readability…

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

Sidebar

Related Questions

Suppose you have a JTable and for each cell you want to display three
Suppose I have a table like so: <table> <tr><td class=this-is-a-label>Label Cell</td></tr> <tr><td>Detail 1</td></tr> <tr><td
Suppose i have the following Moose package: package GSM::Cell; use Moose; has 'ID' =>
Suppose you have an NxN grid, and you want to visit every cell exactly
Suppose I have 2 cells that are merged, lets say Sheet1!$A$1:$B$1 . And lets
Suppose I have the 2 cell as below A1: Hello World B1: orl How
Suppose i have to add numbers in the cell B1, F1, J1 giving a
I have cell formula like C1+C2.suppose i use getcellformula()method it returns the String C1+C2.
For example, suppose I have {={1,2,3,4,5}} in a cell. Is there any way to
I need to write an excel-like grid that can have a lot of cells

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.