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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:23:16+00:00 2026-05-17T18:23:16+00:00

I am using MATLAB and having some issues formatting the output of a matrix.

  • 0

I am using MATLAB and having some issues formatting the output of a matrix. Currently, the matrix looks like:

  Columns 1 through 7

     4     6     5     1     0     0     0
     7     8     4     0     1     0     0
     6     5     9     0     0     1     0
     1     0     0     0     0     0    -1
     0     1     0     0     0     0     0
     0     0     1     0     0     0     0

  Columns 8 through 9

     0     0
     0     0
     0     0
     0     0
    -1     0
     0    -1

Is there a way to get the whole matrix to show up “closer” together, something like this:

 1     0     0     0     0     0
 0     1     0     0     0     0
 0     0     1     0     0     0
 0     0     0    -1     0     0
 0     0     0     0    -1     0
 0     0     0     0     0    -1
  • 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-17T18:23:17+00:00Added an answer on May 17, 2026 at 6:23 pm

    To customize the output, you could try something like:

    x = randi(100, [6,9]);
    
    for i=1:size(x,1)
        fprintf('%d\t',x(i,:));
        fprintf('\n');
    end
    
    23  44  26  23  9   49  53  37  10  
    18  19  41  12  27  58  24  99  27  
    23  91  60  30  81  24  49  4   34  
    44  98  27  32  3   46  63  89  68  
    32  44  61  43  93  97  68  92  14  
    93  12  72  51  74  55  40  80  73  
    

    Or more easily, you could use the NUM2STR function:

    x = randi([-10 10], [6 9]);
    num2str(x)
    
    ans =
     2   1   7   8   9  -1  -1   9   5
     6   8  -3   9  -4   3   8   4   8
    -2  -9  -7   4  -9  -7  -8  -6   7
     1   6 -10   9   6   1  -1   1  -8
     9  -3  10  -5  -9   3   3   8  -7
     8  -6   4   8   5 -10  -4   1  -7
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using polar plots (POLAR(THETA,RHO)) in MATLAB. Is there an easy way to fix
Im using matlab and am having some difficulty. I am trying to swap the
In my matlab m-file I am using some logic (string concat) to build variables
Using C# and System.Data.SqlClient, is there a way to retrieve a list of parameters
I have some differential equations that I need to solve using MATLAB's ODE solvers.
I have an assignment to create a GUI using MATLAB GUIDE and am having
I am linking some fortran code (f90) from matlab using mex and I am
It seems like most image processing apps are done using matlab or OpenCV using
Using online interfaces to a version control system is a nice way to have
Using ASP.NET MVC there are situations (such as form submission) that may require a

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.