in an assignment number A<:> = B, the number of elemnts must be the same

Discussion in 'MATLAB' started by saad, Dec 16, 2010.

  1. saad

    saad Guest

    i make an application tis code run good on matlab 2009a but when i turn it to standalone application C code. function.exe this problem appear at line 11


    1 % Convert it from an index back into ASCII
    2 if (index <= 10) % number
    3 index = index + 47;
    4 elseif (index >= 11 )% upper case character
    5 index = index + 54;
    6 elseif (index <= 36)
    7 % We should never get here
    8 index = index + 54;
    9 end

    10 % Store the decoded character
    11 decoded(i) = char(index); Problem at this line
     
    saad, Dec 16, 2010
    #1
    1. Advertisements

  2. saad

    Steven_Lord Guest

    Remember that when you invoke a standalone executable with an input, like
    "myfunction.exe 5" that the input is passed into the executable NOT as a
    number but as a string. Therefore invoking "myfunction.exe 5" is the
    equivalent of invoking the function file myfunction like "myfunction('5')"
    [note the single quotes in the function call.]

    Use ISCHAR and/or ISDEPLOYED to check for this case and handle your inputs
    appropriately.

    Also, if you named your function "function.m" rename it. FUNCTION is a
    keyword in MATLAB, and if you were to try to invoke your function it would
    not work. Use ISVARNAME to check if your function's name is an allowed
    name -- since FUNCTION is a keyword, it is not a valid variable or function
    name.

    --
    Steve Lord

    comp.soft-sys.matlab (CSSM) FAQ: http://matlab.wikia.com/wiki/FAQ
    To contact Technical Support use the Contact Us link on
    http://www.mathworks.com
     
    Steven_Lord, Dec 16, 2010
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.