Shannon fano coding

9 views (last 30 days)
christopher
christopher on 26 May 2011
[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

Answers (2)

Doug Hull
Doug Hull on 27 May 2011
It appears that on the IF statement line, you have a comment that is not preceded by the % symbol.
  1 Comment
Walter Roberson
Walter Roberson on 27 May 2011
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.

Sign in to comment.


Matt Fig
Matt Fig on 27 May 2011
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 Comment
Walter Roberson
Walter Roberson on 27 May 2011
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".

Sign in to comment.

Categories

Find more on Functions in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!