Discussion:
Learning C++ for Matlab users
(too old to reply)
oyvist
2006-07-10 09:48:46 UTC
Permalink
I am a relatively experienced Matlab user, but now find myself having
to learn C++ in a hurry. I have absolutely no experience with C/C++.
How can I learn this quickly?

Most books for beginners go through all the steps (what is a
variable, what is a function, etc..) I need something that moves a
bit faster, yet still is thorough. "C++ for Matlab users" or
something.. Ideally something that highlights the differences between
Matlab and C++

Does anyone here have experience with moving from Matlab to C++? Do
you know of any good books?

Grateful for any tips.
Kelvin Hales
2006-07-10 10:04:20 UTC
Permalink
Post by oyvist
I am a relatively experienced Matlab user, but now find myself having
to learn C++ in a hurry. I have absolutely no experience with C/C++.
How can I learn this quickly?
Most books for beginners go through all the steps (what is a
variable, what is a function, etc..) I need something that moves a
bit faster, yet still is thorough. "C++ for Matlab users" or
something.. Ideally something that highlights the differences between
Matlab and C++
Does anyone here have experience with moving from Matlab to C++? Do
you know of any good books?
Grateful for any tips.
Been there, done that!

Since the whole 'raison-d'etre' of Matlab was/is to *avoid* the need, especially for Engineers.
to program in computer languages like C and C++ (leaving that stuff to computer programmers),
then I fear there may be no good answer to your request.

I've tried many of the learn C/C++ quick books; but without acquiring much skill. I'll be
interested to see if others have any good suggestions as to what you (and I) could try. I think
part of my problem may be that nowadays I really don't want to learn to program computers, I
only want to use computers to solve problems. (It was different back in the 1970's when I
learned Fortran - in those days it was satisfaction enough just to get a computer to do
anything useful at all!)

Kelvin B. Hales
Kelvin Hales Associates Limited
Consulting Control Engineers
Web: www.khace.com
Rune Allnor
2006-07-10 10:14:59 UTC
Permalink
Post by oyvist
I am a relatively experienced Matlab user, but now find myself having
to learn C++ in a hurry. I have absolutely no experience with C/C++.
How can I learn this quickly?
Most books for beginners go through all the steps (what is a
variable, what is a function, etc..) I need something that moves a
bit faster, yet still is thorough. "C++ for Matlab users" or
something.. Ideally something that highlights the differences between
Matlab and C++
Does anyone here have experience with moving from Matlab to C++? Do
you know of any good books?
Grateful for any tips.
Don't know any books for this, but I have been using both C++ and
matlab
for a number of years. Some of the fundamental differences that you may

want to be aware of, are:

- C++ is statically typed.
Each variable/object must be declared and initialized before it can
be used. Dynamically allocated variables need to be explicitly deleted
after use. In matlab, you pull variables out of the hat as needed.

- C++ uses pointers.
Lots of the power of C++ stems from the fact that you can access
areas in memory through pointers, you don't need to copy the
variable to a local workspace to modify it. Beware; while incredibly
powerful, pointers are also a frequent source of ridiculously-hard-to-
track-down bugs...

- C++ is a compiled language
Whereas matlab is interpreted. Maybe a trivial detail, but one needs to

pay a bit attention to how one organizes the program, how to organize
libraries and so on. Use an IDE or a make file.

- There exist documentation managers for C++
Try Doxygen, http://www.stack.nl/~dimitri/doxygen/, once, and there
is no turning back from C++/Java.

- Stick with a standard C++ (ISO or ANSI).
There are several floavours of C and C++ around. Decide on one
standard NOW and stick with it. If you do that now, and resist any
temptation to use your system's or compiler's cool bells and whistles,

there is hope your programs will be portable.

Rune
Steve Amphlett
2006-07-10 10:35:55 UTC
Permalink
Post by oyvist
I am a relatively experienced Matlab user, but now find myself
having
to learn C++ in a hurry. I have absolutely no experience with
C/C++.
How can I learn this quickly?
Most books for beginners go through all the steps (what is a
variable, what is a function, etc..) I need something that moves a
bit faster, yet still is thorough. "C++ for Matlab users" or
something.. Ideally something that highlights the differences
between
Matlab and C++
Does anyone here have experience with moving from Matlab to C++? Do
you know of any good books?
I learned C from a fantastic book called "C for programmers" by
Leendert Ammeraal. It was aimed at people who could already program,
but wanted to learn a new language efficiently. I've seen that he
has also written a C++ equivalent and suspect it's equally good.
oyvist
2006-07-10 10:47:59 UTC
Permalink
Post by Steve Amphlett
I learned C from a fantastic book called "C for programmers" by
Leendert Ammeraal. It was aimed at people who could already
program,
but wanted to learn a new language efficiently. I've seen that he
has also written a C++ equivalent and suspect it's equally good.
Thanks for the tips. "C++ for programmers" is in my local library, so
I'll check it out.

Loading...