The value assigned to variable <variable_name> might be unused
이전 댓글 표시
please can any one solve these errors of some lines that have red underline because i am novice in matlab and i don't know the basics
here the code :

all of these lines have the same M-Lint warning "The value assigned to variable variable_name might be unused"
>> variable name which has red underline
thank you
댓글 수: 1
Azzi Abdelmalek
2013년 12월 25일
Please post your code as a text not as an image.
답변 (3개)
Walter Roberson
2013년 12월 25일
On lines 4 and 7, add the comment
%#OK
at the end of the line.
Change line 12 to
fclose(Fid);
rather than being an assignment.
댓글 수: 7
n
2013년 12월 26일
Image Analyst
2013년 12월 26일
편집: Image Analyst
2013년 12월 26일
How is this question different than http://www.mathworks.com/matlabcentral/answers/110597-error-unexpected-matlab-operator where Walter and I already started helping you on this question? Why start all over again?
Unused variables are just a warning and do not cause that message box.
Please post father.wav, your m-file, and path1.txt so someone with the appropriate toolboxes (which you still need to list in the Products box under your question) can run your code. For example, what toolbox is melcepst() in?
n
2013년 12월 27일
Walter Roberson
2013년 12월 27일
No, you should not add your files to the voicebox toolbox folders.
What you should do, though, is what I indicated in your simultaneous thread on this topic: show us how you invoked the code from vb.net
Image Analyst
2013년 12월 27일
That's not a Mathworks toolbox, and since probably not many people have it, you may not have a lot of people able to help you. Does your code run if you call it from a different m-file that supplies the same input arguments as you do when you call it from VB?
n
2013년 12월 27일
Image Analyst
2013년 12월 27일
편집: Image Analyst
2013년 12월 27일
Spaces may be messing you up. MATLAB may be interpreting it as two different strings unless you wrap in single quotes. So instead of this:
Result = MatLab.Execute("cd D:\university\sem9\voicebox toolbox")
try this:
Result = MatLab.Execute("cd 'D:/university/sem9/voicebox toolbox'")
Also try forward slashes, which MATLAB and Windows are just fine with:
Result = MatLab.Execute("C:/Users/TOSHIBA/test2.m")
just in case it's using the backslash to indicate a special character like \t or \n.
Walter Roberson
2013년 12월 27일
C:\Users\TOSHIBA\test2
is not a valid MATLAB command.
Use addpath() to add C:\Users\TOSHIBA to your MATLAB path, and then use
test2
Alternately, code
Result = MatLab.Execute("run('C:\Users\TOSHIBA\test2.m')")
댓글 수: 3
n
2013년 12월 27일
n
2013년 12월 27일
Walter Roberson
2013년 12월 27일
Result = MatLab.Execute("addpath('C:\Users\TOSHIBA');")
Result = MatLab.Execute("test2");
댓글 수: 11
Walter Roberson
2013년 12월 28일
You are comparing the result to the string "true", but MATLAB is returning numeric true, which is probably coming through as 1 (and 0 for false)
n
2013년 12월 28일
n
2013년 12월 28일
Walter Roberson
2013년 12월 28일
I am not familiar with Visual Basic. Have you considered altering your MATLAB code to return a string instead of a logical value ?
Image Analyst
2013년 12월 29일
Try
Dim Result as String
and see what that does. Then you might have to change your if to
if Results = "1" then
n
2013년 12월 29일
Image Analyst
2013년 12월 29일
I told you how to change Result to a string like Walter suggested. I don't see any "i" variable so I don't know what you're talking about. Can you put a message box in test2.m as the first line and have it say
uiwait(msgbox('Starting to run test2 now'));
so we can see if test2 is actually being run?
n
2013년 12월 29일
n
2013년 12월 29일
n
2013년 12월 29일
Walter Roberson
2013년 12월 29일
Neither Image Analyst nor I have experience with that kind of audio work.
Have you now isolated the problem as being with your signal-processing and not with the VB to MATLAB interface? If so then it would be time to open a new third Question for the signal processing part.
카테고리
도움말 센터 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




