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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:22:50+00:00 2026-05-27T05:22:50+00:00

I know how to add a matrix below another matrix. e.g A = [A;

  • 0

I know how to add a matrix below another matrix.

e.g A = [A; B];

I have two matrixes of different dimensions(both different number of columns and rows) and i need to add them up together. One matrix is the main one and the other one is being added to it. Both of them are in a for loop and so the dimension of the first matrix is keep changing.

e.g for i = 1 :3
      AngerHist = [AngerHist;Hist];
    end

When I run it is giving me this error :

??? Error using ==> vertcat CAT arguments dimensions are not consistent. – 

How do i do it? Any suggestions?

AngerHist = {}; DisgustHist = {};FearHist = {}; HappyHist = {}; SadHist = {};SurpriseHist = {};
Images = 'C:\Users\HP\Documents\MATLAB\Images';
List = dir(Images);
n= size(List,1);

for i = 3:n
    List1 = dir(fullfile(Images,List(i).name));
    m= size(List1,1);
    BASE_DIR = fullfile(Images,List(i).name);
    for j = 3: m
        I=List1(j).name;
        I1= imread(fullfile(BASE_DIR,I),'jpg');
        Name = List(i).name;
        switch (Name)
                 case 'Anger'
                     Hist = UniformLBP(I1);
                     AngerHist = {AngerHist;Hist};
                     break;
                 case 'Disgust'
                     Hist = UniformLBP(I1);
                     DisgustHist = {DisgustHist;Hist};
                     break;
                case 'Fear'
                    Hist = UniformLBP(I1);
                    FearHist = {FearHist;Hist};
                    break;
                case 'Happy'
                    Hist = UniformLBP(I1);
                    HappyHist = {HappyHist;Hist};
                    break;
                case 'Sad'
                    Hist = UniformLBP(I1);
                    SadHist = {SadHist;Hist};
                    break;
                case 'Surprise'
                    Hist = UniformLBP(I1);
                    SurpriseHist = {SurpriseHist;Hist};
                    break;
        end        

    end    
end
  • 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-27T05:22:51+00:00Added an answer on May 27, 2026 at 5:22 am

    I think that you need to use cells:

    A={};
    A=[A;rand(2,3)];
    A=[A;rand(3,4)];
    A=[A;rand(4,5)];
    A=[A;rand(6,5)];
    

    The result is:

    A = 
     [2x3 double]
     [3x4 double]
     [4x5 double]
     [6x5 double]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Why does C++ need and use pointers? I know they add power to the
I need to add a new matrix to a previously existant matrix, but on
Anyone know an add-in or something that could give me the number of time
I want to know how to efficiently add sparse matrices in Python. I have
Hey! I have matrix class and i want to add, multiply and take transpose
I have n real number variables (don't know, don't really care), let's call them
I know add() adds the specified (signed) amount of time to the given time
I know I can add a icon to the Resources.resx file of a project
I know how to add methods to the MY namesapce, but what I'd like
I know one can add event listener for window.error. However when working with Iframes,

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.