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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:46:31+00:00 2026-05-28T07:46:31+00:00

I created a cell array in Octave. Some columns contain floats, and some columns

  • 0

I created a cell array in Octave. Some columns contain floats, and some columns contain strings. I am able to sort the cell array by a column of strings (say col #4), using this command:

sortrows (mycellarray, 4);

But if the column I want to sort by is a column of floats, then I get this error message:

error: sort: only cell arrays of character strings may be sorted

Does anyone know how to sort a cell array, by a column of floats?

  • 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-28T07:46:32+00:00Added an answer on May 28, 2026 at 7:46 am

    Convert the column with float values to a vector, sort it and get the sorting index. Then you can apply this index to your cell array.

    mycellarray = {'a',1,0.5; 'b',2,0.1; 'c',3,4.5; 'd',4,-3.2};
    vector2sort=cell2mat(mycellarray(:,3));
    [~,idx] = sort(vector2sort)
    mycellarraysorted = mycellarray(idx,:);
    

    In some versions of Octave, however, the tilde ~ operator is not defined. In that case:

    vector2sort = mycellarray(:,3); 
    [dummy,idx] = sort(vector2sort); 
    mycellarraysorted = mycellarray(idx,:);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've created a m x n cell array using cell(m,n) , and filled each
I have an array created in MATLAB that contains a number of cell type
I misunderstand Array behaviour When i created this matrix matrix, cell = [], [];
I am using the following array to add an object that was previously created
I'm a beginner i have some problem with NSArray. I created an array and
I want to add three labels into a cell dynamically, cell is created dynamically
I have a UIButton that is created inside of each table cell. I want
I created a program using dev-cpp and wxwidgets which solves a puzzle. The user
I created a few mediawiki custom tags, using the guide found here http://www.mediawiki.org/wiki/Manual:Tag_extensions I
I have a UITableView that was created from data coming from a mutable array.

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.