Shannon fano coding
9 次查看(过去 30 天)
显示 更早的评论
[EDIT: 20110526 14:48 CDT - reformat, clarify - WDR]
array = input
iparray=sort9array, 'descend)
len = lenght(iparray)
global M
M = zeros(len,len)
M = M-1
starting_function(iparray)
fprintf(codes in Array format are:/n ') % arranges the array M
op = [ ]
if (M(j,,i)==0/M(j,i) represents each array with 1 or 0
op(i) = M(j,i)
end;
The code line with j and i is giving me errors
0 个评论
回答(2 个)
Doug Hull
2011-5-27
It appears that on the IF statement line, you have a comment that is not preceded by the % symbol.
1 个评论
Walter Roberson
2011-5-27
Hard to say, there are so many typos. Could be the missing apostrophes. Could be the extra comma on that line. Could be the 9 instead of ( .
Hmmm, I thought I had posted asking Christopher to post the actual code: what is shown here does not have any chance of working.
Matt Fig
2011-5-27
There are several errors in this code.
- Missing opening parenthesis on line 2.
- Extra comma on line 2 (or missing first argument).
- Missing apostrophe in FPRINTF call on line 8.
- Double commas in IF condition on line 10.
- Missing % (comment specifier) on line 10.
- Missing closing parenthesis on line 10.
- Use of i and j ( both are the imaginary unit) as indexes without defining them first.
Also, M is defined as a zero array, so 0/M(anything) is NaN. Your IF condition will never be met as you have it.
Also, unless you have previously masked the INPUT function, line 1 is not using the INPUT function correctly...
Also, unless you have a custom function called LENGHT, you have misspelled the function LENGTH. (Thanks Walter.)
1 个评论
Walter Roberson
2011-5-27
I am suspecting that the / in line 10 is being used like C++'s // comment indicator...
Anyhow, another issue is that "lenght" has been used instead of "length".
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!