Shannon fano coding

8 visualizzazioni (ultimi 30 giorni)
christopher
christopher il 26 Mag 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

Risposte (2)

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

Accedi per commentare.


Matt Fig
Matt Fig il 27 Mag 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 Commento
Walter Roberson
Walter Roberson il 27 Mag 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".

Accedi per commentare.

Categorie

Scopri di più su Functions in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by