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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:40:53+00:00 2026-06-15T01:40:53+00:00

I am trying to find max value of a struct but max([tracks(:).matrix]) does not

  • 0

I am trying to find max value of a struct but max([tracks(:).matrix]) does not work. It gives me the following error: “Error using horzcat
CAT arguments dimensions are not consistent.” Do you have an idea?

Here is what my struct looks like:

tracks = 

1x110470 struct array with fields:
    nPoints
    matrix

tracks.matrix includes 3D points. For example here is

tracks(1,2).matrix:

33.727467   96.522331   27.964357
31.765503   95.983849   28.984663
30.677082   95.989578   29
  • 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-15T01:40:54+00:00Added an answer on June 15, 2026 at 1:40 am

    You can use array fun, followed by another max to do this:

    s.x = [1 3 4];
    s(2).x = [9 8];
    s(3).x = [1];
    
    maxVals = arrayfun(@(struct)max(struct.x(:)),s);
    
    maxMaxVals = max(maxVals(:));
    

    Or, if you want to retain the size of .x after MAX:

    s.x = [1 3 4];
    s(2).x = [9 8 3];
    s(3).x = [1 2 2; 3 2 3];
    
    maxVals = arrayfun(@(struct)max(struct.x,[],1),s,'uniformoutput',false);
    
    maxMaxVals = max(cat(1,maxVals{:}))
    

    Or, if you know everything is n x 3

    s.x = [1 3 4];
    s(2).x = [9 8 3];
    s(3).x = [1 2 2; 3 2 3];
    matrix = cat(1,s.x)
    maxVals = max(matrix)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to find the max value contained in two separate fields of my
I'm trying to find the max machine number x that satisfies the following equation:
Trying to find an example that has css rollover using sprites & sliding door
Trying to find examples of when decorators might be really beneficial, and when not
I am trying to find out the maximum value for an integer (signed or
I am trying to implement the following algorithm using the divide and conquer method
I'm trying to plot 4 average values with positive error bars and the max
I've been trying to find the largest result in a list - using the
I am trying to find a way to collect data using sql aggregate functions
NOTE: I am trying to find the name of the specific LRU algorithm, not

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.