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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:36:59+00:00 2026-06-04T17:36:59+00:00

I’ve been stumped trying to create an if,else loop that transposes the following: Subject:

  • 0

I’ve been stumped trying to create an if,else loop that transposes the following:

Subject: Date: Result:
AAA 02/01/12 10
AAA 02/02/12 12
AAA 02/03/12 14
BBB 02/01/12 25
BBB 02/02/12 26
BBB 02/03/12 27
CCC 01/01/12 66
CCC 01/02/12 70
CCC 01/03/12 75

I desire the information to be transposed across columns as depicted below:

SUBJECT 01/01/12 01/02/12 01/03/12 02/01/12 02/02/12 02/03/12
AAA RESULT
BBB RESULT
CCC RESULT

There should only be one date per column and one subject per row. The result will match its respective subject and placed in its appropriate cell. The data can consist anywhere from a few subject to thousands of subjects, dates, and results. Some results may consist of non numerical values (NaN). Also, the subjects and dates may me in any random order and subjects may consist of numeric and string characters.

UPDATE
@amro & superbest

If I had a text file with the date format:800317==mar/17/1980,
How would I import this and modify the codes you’ve written?
THanks again.

  • 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-04T17:37:01+00:00Added an answer on June 4, 2026 at 5:37 pm

    Here’s a script which should do what you want:

    % Clean up
    clc
    clear
    
    % Hardcoded example input
    input = {
        'AAA'    '02/01/12'    10
        'AAA'    '02/02/12'    12
        'AAA'    '02/03/12'    14
        'BBB'    '02/01/12'    25
        'BBB'    '02/02/12'    26
        'BBB'    '02/03/12'    27
        'CCC'    '01/01/12'    66
        'CCC'    '01/02/12'    70
        'CCC'    '01/03/12'    75
        };
    
    % Figure out how many rows and columns there will be
    header_row = unique(input(:, 2));
    header_col = unique(input(:, 1));
    
    % Pre-allocation for better performance
    output = cell(length(header_col), length(header_row));
    
    % Rearrange the array
    for i = 1:size(input, 1)
        % Find to which date and subject this element belongs
        subject = find(strcmp(header_col, input{i, 1}));
        date = find(strcmp(header_row, input{i, 2}));
    
        % Put the value in the appropriate slot
        output{subject, date} = input{i, 3};
    end
    
    % Add header columns and rows and print the result
    result = [['SUBJECT' header_row']; [header_col output]];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create an if statement in PHP that prevents a single post
Basically, what I'm trying to create is a page of div tags, each has
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I am trying to loop through a bunch of documents I have to put
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace

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.