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!




