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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:46:41+00:00 2026-05-26T06:46:41+00:00

Say I have a cell array, that holds a stack of logical matrices, e.g.

  • 0

Say I have a cell array, that holds a stack of logical matrices, e.g.

matrices = 
    [225x400 logical]
    [225x400 logical]
    ....
    [225x400 logical]

The cell array can potentially hold hundreds of matrices.

I would like to compute a single matrix that is the result of the concatenation of binary operations on this matrices.

i.e.

result = matrices{1} & matrices{2} & matrices{3} & ..., etc.

My question: Is it possible to do this without looping? And if so, is there any benefit in vectorizing this computation MATLAB?

What if the stack of matrices is represented as a 3D array (instead of a cell array?), e.g.:

  Name                        Size                  

  matrices                  225x400x100

Is there any benefit in holding these types of stacks as cell arrays vs 3D matrices? (to clarify, in this last example, we would compute the AND of 100 matrices, each of them of size 225x400).

PS: I’m interested in solutions to AND, XOR and OR

  • 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-26T06:46:42+00:00Added an answer on May 26, 2026 at 6:46 am

    You can’t do vectorized computations on cell arrays. You have to convert it to a 3D array (using cell2mat), or even better: pre-allocate a 3D array.

    Then, with dimensions 225x400x100 you can do:

    or:

    any(matrices,3)
    

    and:

    all(matrices,3)
    

    xor:

    mod( sum(matrices, 3), 2)
    

    The benefit of cell arrays is memory preservation (e.g., once you delete a cell). Once your cell array is stable you should turn it into a matrix for vectorized computations, which is much faster than Matlab loops.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have the cell array strs = {'HA' 'KU' 'LA' 'MA' 'TATA'}
I have array of Objects (let say that class name is Snap) Snap. Is
Say I have a cell array: my_cell_array = {'Jimmy', 'Timothy', 'Charles', ...} Is there
If I have a Range object--for example, let's say it refers to cell A1
Let's say I have an array of DataTable[] . In each DataTable there are
This time, I have a cell holding a natural number, let's say 10. Starting
Let's say I have a UITableView that is part of an iPad app doesn't
Assume that we have an array of integers (3x3) depicted as follows: +-+-+-+ |
Say I have an array of strings I am displaying the following data in
Is there a pre-implemented linked list out there that would have been implemented using

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.