MatLab: Line break between arguments of a function

1

When writing a function with arguments in MatLab, can the arguments be separated by a line break in some way (similar to separation by whitespace characters such as space or tab being allowed)? An example is to change this code line

choice = inputdlg(prompt,dlg_title,num_lines,defaultans);

to these lines

choice = inputdlg(
  prompt,
  dlg_title,
  num_lines,
  defaultans
);

This particular syntax does not work, but it shows the idea that is possible in many other programming languages. Is it possible in MatLab as well?

Steeven

Posted 2018-02-08T14:04:38.160

Reputation: 231

Answers

2

Long lines can be continued...

>> choice = inputdlg(prompt,...
dlg_title,...
num_lines,...
defaultans);
Undefined function or variable 'prompt'.

>> 

however this is perhaps not an improvement.

thrig

Posted 2018-02-08T14:04:38.160

Reputation: 686

This is the way to do it! It's definitely an improvement in function calls with lots of parameters or very long ones, like file locations. – kmc – 2018-02-08T17:51:10.603