Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

C++ Shared library - Matlab

Status
Not open for further replies.

Zohair08

Newbie level 4
Joined
Mar 15, 2010
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
London
Activity points
1,315
Hello everyone!

I have done this example about converting matlab to c++ and creating a shared libraby (http://www.kxcad.net/cae_MATLAB/toolbox/compiler/f2-995712.html).

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.

cheers
zoh
 

Hi,

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 '\\'.

Sudan
 

Dear Sudan,

Thanks for your help. It's good way to receive input but I want to post my parameters as:

Code:
./my_command -para1 value1 - para2 value2

Any suggestion?

Thanks again.

Zohair
 

Hi,

You can declare a string array. Then assign input() to that array. Please try...

Sudan
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top