So Veeky Forums, why is MATLAB such a pain in the arse?

...

Other urls found in this thread:

en.cppreference.com/w/c/language/initialization).
undocumentedmatlab.com/
twitter.com/SFWRedditGifs

Stop writing loops and use vectors nigger

because you're bad at programming

It isn't tho

Get good bitch

I only have experience with C and Matlab and I have to say that Matlab is hands down the better language.

Use wolfram.

First time I ever used MATLAB was for my classical controls class, now i pretty much use it for almost everything

C++>Matlab desu

Bash it all you like, and I personally prefer Python with NumPy over it for run of the mill numerical computations. In the background, they all use BLAS/LAPACK anyway.

However, Simulink is a product without equal. Simulink is fucking godlike.

Because it's made for engineers.

Because you suck too much at programming to take advantage of the features of MATLAB.

oh look you've never tried any other programming language

MATLAB is crazy fast. What the fuck

Matlab starts indexing at 1, instead of zero.

Biggest complaint in only corner cases, like paraxial ray tracing where I want to start indexing at n(0) but I'm forced to use n(1)

im also a C/Matlab programmer. you're wrong, C is the most beautiful language. Matlab is good for testing ideas, C is better for actual software

It's also annoying for doing spatial transforms on images since the origin is located in different places and starts at different numbers.

>However, Simulink is a product without equal. Simulink is fucking godlike.
This so fucking much. Now that it can generate good code for many DSPs, I'll be obsolete in a few years.

Wuh? There's literally a function for everything, it requires lots of memorization, but once you've got that down, there's basically no thinking required.

because you're retarded

FORTRAN > C++ > Python > C > everything else > MATLAB
t. A guy using MATLAB every day in a scientific context

Matlab is one of the worst languages ever conceived.

C is "harder" to use because it is lower level and you have to think about what you are doing, it is an awesome language if you use it for the right task.

But matlab is pure garbage, a type system that deserves to get someone killed and just retarded thing like not being able to select things from a matrix you created.
eg.:
ones(10,10)(1,1)
Which works perfectly fine in Octave.

Only its standard library is awesome.

Only if you do matrix stuff, everything else is really fucking slow.

Nothing wrong with that, its main data type are matrices and not arrays, it has a lot more problems then that.

Julia FTW.

yep

...

>itt plebs who can't code a simple for loop

>MATLAB is crazy fast
lel

daily reminder that
Julia > matlab >>>>> R

Communism is not and will never be "open"

C++ and C need to be switched and this guy is right

What the fuck does this even mean.

it means he's a 13yo poltard

What are the current drawbacks of julia?

Everything you can do in C you can do in C++ and more.

I worked with java, JavaScript, Typescript Matlab is great pleasure to work with.
You can waste anything if you are dumb anough but with right hands Matlab is awesome.

Program in APL or J. These languages strictly enforce the array-oriented programming paradigm. Once you've gotten in terms with array programming, MATLAB won't be a pain in the ass.

then what's in that orange area smart guy?

Variable length arrays, ABIs, weaker type protection and void being handled differently...

Shit 99.95% of most people wont care about.

Except you have a shitty compiler

weaker type protection (which includes void being handled differently, as you put it) imho is inside the shared circle, considering how C++ gives the same guarantees as C plus stuff - there are no guarantees C gives that C++ doesn't, as far as I'm aware.

the ABI would be the orange slice there, imo.

not sure what exactly you mean when you say "variable length arrays". please elaborate.

It's Julia

last i checked the C generated from simulink was prototype grade throwaway trash with unfuckingbelievable caveats, such as "use floats for binary values". has that changed? must be recent, seeing how my colleagues (2016a is I think what they're currently using) are still writing scripts to fix their builds right now.

that being said, for the aforementioned prototyping purposes and use cases where that kind of code quality is sufficient, Simulink is king. not to mention letting engineers use it for their simple data analysis of experiments (where I still think a properly setup with python or C++ is technologically superior, but teach that to an engineer...).

if you think FORTRAN > C++, it is due to your lack of knowledge of C++11 and later versions.

wtf i hate R now

>not sure what exactly you mean when you say "variable length arrays". please elaborate.

In C you can do:

void mergesort(int* list, int size){
int scrap_space[size]; //size is from the argument and not const
....
}

Where in C++ you need to malloc/new it or use vector classes.

this is the shittiest list i have ever seen. holy shit.

1. matlab is a multi purpose prototyping fuckfest, I'm sorry, language. like Python. NOT like R OR Julia, which are both heavily purpose driven.
2. if "IDE" is this high up on your list of pros/cons, you have your priorities all backwards. if you give the Matlab IDE, which is absolute and utter dogshit compared to something deserving of the name "IDE" (see: QtCreator, CLion), three thumbs up, you are beyond delusional.
3. R is absolutely fucking wonderful for what its made: a statistician's calculator. like, absolutely and utterly wonderful, well designed, nothing even compares. its viability ir proven not only by the fact that statisticians of all scientific fields, even the most retarded biology asshats you'll ever meet, are successfully and efficiently using it, but also by its wide adoption by related communities which came to be (popular) even after the conception of R.
4. Julia from the very beginning has been designed as a high performance computing language competing with the likes of FORTRAN and C++. if it DIDN'T have the features you list and give it three thumbs up on - (strong) type system, pass by reference, distributed computing, (sparse) linear algebra, profiling, C/FORTRAN/library interfacing - that would have to be considered a major fucking design flaw. you're giving a minivan three thumbs up for having more than five seats.
5. what you don't mention at all - even though it is hugely more important than, say, IDE - is standardization and library availability for each language. which, for R, is okay for its use case; for Matlab, is okay - especially on the standardization part Matlab is a dream for organizations as they're buying support and "complainability" with their license; and for Julia, is complete and utter dogshit on both accounts.

so yeah, delete this trash right now.

ah, i see what you mean.

1. use std::vector for this case. it's optimized, among other things, also on allocation size and will not necessarily dynamically allocate if it doesn't see fit to do so. more importantly, its optimization will make use of compiler builtins where possible, generating the most efficient version of your code.
2. if you know - or can compute - the size at compile time, you can use constexpr and std::array.
3. the code you posted is, of course, completely legal C++ code, so this is also within the purple section of the venn, not the orange slice.

it's becoming a frankenstein language like C++. Started out good but they tried to do many things instead on focusing on a few, the result is twofold: syntax has a shitton of variance depending on what you are doing and there are ridiculous methods for simple things due to multiple dispatch

ITT
Engineers.

to continue on that std::vector argument:

your code will create a C array of ints with size "size", thus performing a zero-initialization of "size" integer elements inside the array (see en.cppreference.com/w/c/language/initialization). if you had use a vector, you could have done the following:

void mergesort(int * list, int size) {
std::vector scrap_space;
scrap_space.reserve(size);
...
}

which would avoid intializing arguments completely but only reserve the space you need. then, by calling

scrap_space.emplace_back(/* value */);

you can postpone the value initialization to the point in time when you're actually filling the array.

number of operations, your code: size*(number_of_accesses_to_array)
number of operations, my code:
(number_of_accesses_to_array)

you can further optimize std::vector to your liking by providing your own allocator.

Not just that, but a recent update broke most of the user created packages.

>3. the code you posted is, of course, completely legal C++ code, so this is also within the purple section of the venn, not the orange slice.

It's not legal ISO C++ code. Compilers just implement it anyway.

you are correct, i was not aware.

however, your code is still easily made legal even under ISO C++ by doing

void mergesort(int * list, const int size) { /* ... */ }

there's no reason size can't be const, and you can still pass in any int.

...

I think you mean plebs who can't code without for loops. MATLAB is optimized for vectors, not large loops.

It's shit.

>annoying interface
>sort of fast but not actually fast
>proprietary
>vector shit

>Arguing over a program when certain programs cater best to certain systems to study.

What about wolfram?

What problems do you have with the interface? I find that it has all I need: a variable tracker, file explorer, console, editor, and run button. I use it primarily for image analysis and DSP/Simulink.

Its your own fault that you're too stupid to program with vectors, which makes algorithms significantly faster than iterative approaches. Any runtime bloat is offset by the huge decrease in prototyping time. MATLAB is at the core a very high level scripting language designed with rapid prototyping in mind, it is not a programming language and should not need treated as such.

No such thing as better languages retard, only different applications. C is completely different to Matlab so they're not even slightly comparable.

how do you even vectorize code in matlab? i have a program that I use to generate electric field data and I have it currently set up with for loops to load the vectors. How do you do ir without

Cleverness, in depth knowledge of matrix indexing, and exploiting linear algebra techniques. Not all calculations can be done with purely vector operations, but if you're repeatedly dealing with data sets bigger than 100, you will benefit from vectorizing for optimization.

I don't know your specific implementation but you could try looping to load all the data sets, storing them into a matrix or one really long vector, and performing calculations once. Exporting data is trivial. This banks on the fact that you can vectorize the calculations.

A lot of image processing calculations require the image be formated into a long vector instead of a matrix because some clever idiot found out that by expanding the calculations done to discrete data set, they can be simplified to a matrix multiplication or something. That's say 2,000,000 point calculations condensed into a single optimized matrix multiply in MATLAB.

If you want a language that isn't C++ for researchers that isn't python because muh performance

Use julia senpai

>coding in raw C with no intention to compile cross-platform code
Why?

Is there a way to do this in Matlab without for-loops?

Yes.

Its the easiest way to implement anything you brainlet

f(meshgrid([a,b,c], [x,y,z]))

matlab is comfy
t. chad engineer

>chad
>using faggotOS
lol

I actually use a mac installed thinkpad

wtf is wrong with you

it's better for programming than windows and just werks unlike linux

>not being able to select things from a matrix you created.

I agree, this is incredibly annoying. And you would think that you could fix it just by writing (ones(10,10))(1,1), but no.

>makes autistic dynamic simulations and screencast them to post on an anime imageboard
>in Matlab
>on a Mac because he believes its better for programming than windows
kek (probably doesn't know VS exists)
>refers to himself as a chad
I'm surprised you even asked

t. non-posturing machine learning researcher/software engineer

>VS
gross

>Mac
*Thinkpad he purposefully installed Mac on

Give me a better IDE and/or debugger

>inb4 CLion and other IDEA shit
They make a large portion(if not still most) of their money from Resharper shit in VS

it probably is best for what you're using it for, it's just that what you're using it for is gross

UNIX based systems are objectively better and less painless than windows when cross-compiling.

>less painless
Agreed

But CMake build systems aren't that bad. otherwise interpreted langs don't really have cross compilation problems as often

>Working on the most meme field of the current year

You work on a quantum computer too? :^)

Best books or other to learn matlab?
Need to get good with it before the summer 2018

QUICK
WHAT LANGUAGE SHOULD A CHEMICAL ENGINEER LEARN?

don't know about books, but a good website is undocumentedmatlab.com/

Python and C++/C is a great combo in any scientific field. Many programs used in molecular modeling such as PyMOL and openbabel are written in Python.

Cause my name doesn't start with Pajeet

Python is real popular and only getting more popular, so not a bad idea
Otherwise C# C++ for general programming or R for data science

This. You can't really compare R and MATLAB like that, they are completely different languages used for completely different things. No one opens R with the intention to linear algebra lol