I'm trying to output 3 points from a code I've written and I keep getting this same error when I run the code:
??? Error using ==> fprintf
Function is not defined for 'sym' inputs.
Below is the for loop I have created that I'm trying to run. Any suggestions or ideas? I've tried fwrite also and that didn't work either.
for x = (r_h/R):(1/10):1;
for Ch = 0:((x/c)/10):(x/c);
%These are solved for earlier in the code
VAR1 = EQS.A;
VAR2 = EQS.B;
VAR3 = EQS.C;
VAR4 = EQS.D;
VAR5 = EQS2.E;
VAR6 = EQS2.F;
VAR7 = EQS2.G;
VAR8 = EQS2.H;
EQUATION1 = (VAR1)*x.^3 + (VAR2)*x.^2 + (VAR3)*x + VAR4;
EQUATION2 = (VAR5)*Ch.^3 + (VAR6)*Ch.^2 + (VAR7)*Ch + VAR8;
Z = EQUATION1 * EQUATION2;
fprintf(fid1,' %8.2f %8.4f %8.8f\n',[x; Ch; Z]);
end
end
When I run the code and have x, Ch, and Z displayed I get numbers but once the code reaches the fprintf statement, the error occurs. So I know the equations are giving me numerical values just not sure why the code wont write them to a file.
Any help or comments would be of great help! Thank you.
"Devin Witt" <snocro...@yahoo.com> wrote in message
news:ibq6cf$8fl$1...@fred.mathworks.com...
> Hello,
>
> I'm trying to output 3 points from a code I've written and I keep getting
> this same error when I run the code:
>
> ??? Error using ==> fprintf
> Function is not defined for 'sym' inputs.
That's correct; you will need to convert the SYM object into something
FPRINTF understands (like a double or a char array) in order to print it.
*snip*
--
Steve Lord
sl...@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com