MATLAB Answers

1

combining evalfis with sprintf

Hello,
I am trying to combine evalfis with sprintf in order to use it repeatedly within a loop. The command I use is the following:
evalfis(sprintf('[%1.0f %1.0f %1.0f %1.0f],fis',j,deg1,deg2,deg3))
I receive the following error message:
Need at least two inputs ??? In an assignment A(I) = B, the number of elements in B and I must be the same.
if i use evalfis without sprintf works, and sprintf alone is working great when copying the result to evalfis.
Can you suggest me anything?
Thank you in advance
Sotiris

  댓글 수: 0

로그인 to comment.

답변 수: 2

Walter Roberson 님의 답변 13 Jun 2011
 채택된 답변

evalfis() requires a numeric input for the first argument, not a string.
evalfis() requires a minimum of two arguments according to the documentation
When you are copying the output of sprintf to evalfis, you are probably copying and pasting, which would cause the command interpreter to parse the text and convert it in to numeric form.

  댓글 수: 0

로그인 to comment.


Sotiris 님의 답변 13 Jun 2011

You were right, i changed the command from 1 to 2 lines as follow:
input=[j deg1 deg2 deg3];
out(z)=evalfis(input,fis)'
Thank you for your suggestion
Sotiris

  댓글 수: 0

로그인 to comment.



Translated by