Why does Matlab mex does not have a day type like scanf

Here's my problem, I have a c++ code that I'm compiling in mex and so far it's doing great. But it's supposed to take different input from the user to perform different tasks. When it prompts the user to enter the input and canny recognize it. I've read on plenty website that mex doesn't have scanf and getchar. But I fount this example in the Matlab website with the reply and isempty function but that created more errors for me. Is there any other way.
Im using R2007b, and win64,window7.VS 2005.
The part I want to fix goes like this:
scanf("%c%*[^\n]",&ans);
getchar();
If(ans==I){
Do this}
If (ans==b)
{
Do that
}
else
{
Do nothing
}
The code itself runs great in C
Please help

댓글 수: 1

What does this sentence mean: "But I fount this example in the Matlab website with the reply and isempty function but that created more errors for me"?

댓글을 달려면 로그인하십시오.

답변 (3개)

Jan
Jan 2013년 1월 24일

0 개 추천

You can use mexCallMATLAB to call Matlab's input() or any other Matlab commands.
Mini Me
Mini Me 2013년 1월 24일

0 개 추천

Walter Robertson, And Jan Simon That mexCallMATLAB(1,&num.....) does not seem to take any characters. It creates an error stating no conversion from int to mxArray. Not sure if I'm doing this right but I want to use character input instead of numbers but so far I get errors

댓글 수: 1

Did you read the documentation of this command already? See: doc mexCallMATLAB. Obviously you did not use the command correctly as the error message tells you. If you post the code, we had a chance to give a suggestion for improvements.
Please post comments in the comment section, not as an answer. Thanks.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 MATLAB Compiler에 대해 자세히 알아보기

질문:

2013년 1월 23일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by