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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:02:02+00:00 2026-05-23T22:02:02+00:00

I have a cell array of numbers but the majority of the cell array

  • 0

I have a cell array of numbers but the majority of the cell array is empty for example:

x = 

[]    [6]    []    [4]    []    []    []    [1]

I have a matching array y

y = [1, 3,1,5,7,3,1,5]

I want to get the index of the numbers from the cell array x and use them to get the corresponding values from y. So x(2) matches with y(2). I convert x to a array using

x = cell2mat(x); 

But the problem is that it returns

x = [6,4,1]

This does not allow me to get the correct index so I can then sort X and then sort Y accordingly so the same indices match up. I tried to use sort that does not work for cell arrays.

  • 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-23T22:02:02+00:00Added an answer on May 23, 2026 at 10:02 pm

    Just use y(x); that will return indices 6, 4, and 1 from the y vector.

    Note that the order of the returned matrix will depend on the order of the indices in x; if you want to sort x, do it before running y(x).

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

Sidebar

Related Questions

I have an array, I want to save this in UITable, but it is
I have a 2D cell array. I want to do the following: y =
I have three arrays, all the same size: xout % cell array xin %
You have: val array = new Array[Array[Cell]](height, width) How do you initialize all elements
I don't have a cell phone, but Google App Engine needs an SMS message
I want to do quick calculations in Excel. I have a cell (A1) with
I have a custom cell renderer set in JTable and it works but instead
I have a 2-dimensional array of objects and I basically want to databind each
I have an array named bookmark,it contains values,i displayed it in a tableview cell,i
I have a function to get the values of the selected check-box from the

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.