The programme adds and multiplies two matrices. The issue is that in this example the input matrices themselves are defined in the driver code itself.
Code:
double data[] = {1,2,3,4,5,6,7,8,9};
Do you know how to make this more general by receiving the matrices as inputs or parameters? In other words, I want this to receive inputs and do calculation.
For solving your problem you can use input() function in MATLAB. For Example...
R = INPUT('How many apples') gives the user the prompt in the
text string and then waits for input from the keyboard.
The input can be any MATLAB expression, which is evaluated,
using the variables in the current workspace, and the result
returned in R. If the user presses the return key without
entering anything, INPUT returns an empty matrix.
R = INPUT('What is your name','s') gives the prompt in the text
string and waits for character string input. The typed input
is not evaluated; the characters are simply returned as a
MATLAB string.
The text string for the prompt may contain one or more '\n'.
The '\n' means skip to the beginning of the next line. This
allows the prompt string to span several lines. To output
just a '\' use '\\'.