Shannon fano coding

9 次查看(过去 30 天)
christopher
christopher 2011-5-26
[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

回答(2 个)

Doug Hull
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
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
Matt Fig 2011-5-27
There are several errors in this code.
  1. Missing opening parenthesis on line 2.
  2. Extra comma on line 2 (or missing first argument).
  3. Missing apostrophe in FPRINTF call on line 8.
  4. Double commas in IF condition on line 10.
  5. Missing % (comment specifier) on line 10.
  6. Missing closing parenthesis on line 10.
  7. 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
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".

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Functions 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by