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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:55:15+00:00 2026-05-30T09:55:15+00:00

I have written a for loop in which to split 5000 rows accordingly along

  • 0

I have written a for loop in which to split 5000 rows accordingly along each of the columns that they are in.

Example of the cell array that contains those rows:
enter image description here

From that picture, i would like to split each row accordingly along their respective columns of that row starting from the first column to the end.

This is the code that i have written:

for i = pdbindex(:,1)

    clean_pdb = regexprep(pdbindex, ':', ' '); % removes the colon (:) from the array and replaces it with a whitespace
    pdb2char = char(clean_pdb); % converts the cell array into a character array
    pdb2split = strsplit(pdb2char, ' '); % does a split based on the character array followed by a delimiter, which is the white space

end

I have used Regular Expressions to replace the colons (:), with a whitespace. However, it is throwing me an error stating Input strings must have one row.. I don’t know how to solve this.

Please advise.

  • 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-30T09:55:16+00:00Added an answer on May 30, 2026 at 9:55 am

    I would do this like this:

    %Some sample data
    data = {'1 : 2  :  3 :4: 5: 6';'7 :8 : 9: 10 :11 :12'};
    

    The Divide all the rows based on delimiters (a delimiter is any combinations of white space and “:”)

    splitData = regexp(data,'[\s\:]*','split')
    

    Now your split data can be read out as

    example = splitData{row}{column};
    

    Most likely you will want to convert this to numbers (not strings). You can do this one row at a time like this:

    numericRow = num2double(splitData{rowNumber});
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a loop written in C++ which is executed for each element of
I have written a C# app that runs constantly in a loop and several
I have written an Android application that uses SQLite database which is saved in
related (sort of) to this question. I have written a script that will loop
I have written a simple script that calls a function in a while loop.
I have written a console application, which is essentially a Console.ReadLine()-Loop. When the application
I've written the following code. I have a loop which iterates between two red
I have a written a loop for and if condition and I want to
I'm trying to understand how a while loop looks in IL. I have written
I have written an AIR Application that downloads videos and documents from a server.

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.