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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:51:31+00:00 2026-06-03T14:51:31+00:00

In Matlab, the following statement gives a numeric output . . >> ‘abc’ +

  • 0

In Matlab, the following statement gives a numeric output . .

>> 'abc' + 'def'

ans =

   197   199   201

In C++, the output of the following

std::string("abc") + std::string("def") 

…would give the arguably more useful…

abcdef

A little more exploration gives..

>> a = 'abc'

a =

abc

>> whos
  Name      Size            Bytes  Class    Attributes

  a         1x3                 6  char   

This suggests that my variable a is a char type. However, we know that this is not equivalent to a C type char, as it is an object that knows its size dimensions etc.

Therefore, my questions are:
What use would this numeric output be?

…leading to

Why would they design it to behave like that?

  • 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-03T14:51:32+00:00Added an answer on June 3, 2026 at 2:51 pm

    Because a string in Matlab is literally just an array of char type, so it’s equivalent to:

    [97 98 99] + [100 101 102]
    

    It is not set in stone that + means “concatenate”. If you want string concatenation in Matlab, you can always do:

    ['abc' 'def']
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I do the following in MATLAB: ppval(mkpp(1:2, [1 0 0 0]),1.5) ans =
I normalize a vector V in MATLAB as following: normalized_V = V/norm(V); however, is
I have a problem with Matlab - I need to do the following :
I'm running matlab on my local machine and I'm calling the following function from
I have the following matlab code: randarray = gpuArray(rand(N,1)); N = 1000; tic g=0;
I want to vectorize the following MATLAB code. I think it must be simple
The x-axis and y-axis are interchanged in the figure by running the following matlab
Say I have a string in a variable in MATLAB like the following: this
The following stackoverflow qestion: Matlab: How to obtain all the axes handles in a
The Following is the basic skeleton for my MATLAB program. Each box is 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.