Shannon fano coding

조회 수: 8 (최근 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