â07-15-2008 10:27 AM
â07-15-2008 09:29 PM
â07-16-2008 09:17 AM
â07-16-2008 08:59 PM
Hi Jeff,
Yes, 2D array is acceptable in MathScript.
I will try to give detail about your question. If I miss anything, please let me know.
Define array - You should use [ ] to define and initialize an array. For example, A = [1 2 3; 4 5 6; 7 8 9] defines A to be a 3-by-3 matrix. Comma or space character separates element by element in one row. And, semicolon character separates row by row.
[ ] - Another situation to use [ ] is to define a function. You should use [ ] to specify output, such as function [a, b] = foo(g, h).
( ) - Parenthesis is widely used in MathScript. 1) In a formula, parenthesis gives high priority to calculations within it, such as a*(b+c); 2) It is used in function call, such as sin(a); 3) It is used to specify input when you define a function.
{ } - MathScript can not accept cell array by now. Therefore, { } is not used.
' ' - Single quotation is used to define a string variable, such as b = 'MathScript'.
; - Semicolon is used to separates row in matrix or end a command, such as c = sin(1);. If you end a command with semicolon, it suppress the display out in MathScript Window. This does not work in MathScript Node.
... - It is used to separate a long formula into two lines, such as
d = 1*...
(2+3)
â07-17-2008 06:07 AM