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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:34:14+00:00 2026-05-27T16:34:14+00:00

I have 2 columns of data imported from using textscan. The data looks like

  • 0

I have 2 columns of data imported from using textscan. The data looks like this where U is undetect and D is detect

mydata=

.51 U
.57 D
.48 U
.47 D

 my data = [4x1 double]    [4x1 char]

I want to sort the data by the first column and so the data would look like this

.47  D
.48  U
.51  U    
.57  D

I would like to preserve the cell structure so that the following command to assign logical value still hold true:

c = zeros(size(mydata,1),1); % preallocate empty matrix 

c = mydata{2} == 'U';
for i = 1:size(mydata,1)
      curValue = mydata{i,2};
      data{i,3} =  ~isempty(curValue) && ischar(curValue) && strcmp(curValue ,'U');
end

I read about sortrows but the function is used to sort matrix containing just numbers.

Does anyone have a solution for sorting arrays with a mixture of numbers and characters.

  • 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-27T16:34:14+00:00Added an answer on May 27, 2026 at 4:34 pm

    You can SORT by one vector and apply the sorting index to another vector.

    [mydata{1},idx] = sort(mydata{1});
    mydata{2} =  mydata{2}(idx);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have code that looks like: //System.Data.IDataRecord dr try { Consolidated = Utility.NullConvert.ToBool(dr[Constants.Data.Columns.cConsolidated], false);
I have a problem using data from a tab delimited data file imported with
I have a data model that includes common columns like addedBy, editedby (user), addedDate,
I have database in which data is imported from the other table. if data
I have denormalized data (coming from a file) that needs to be imported into
I have imported data relating to about 70 human subjects from three data tables
We have some imported data from a 3rd party which provides non-integer unique ids.
I have two tables that have identical columns. One table houses imported data, the
I have three columns of data. Is there a way using vba to insert
I have data imported from an excel sheet into a table in db. Now

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.