writing some parameters from mfile on txt file and problem with some parameters
Show older comments
Hi all
I am trying to write some parameters from one matlab file , by defining a function that does this writing on a txt file
on the main file I have some parameters like :
p1 = 12.5;
q=2*p1;
tb=7.49;
tf=1.2;
tw=1.63;
teta=85;
d0=70;
dep=1;
Et= 109.36e9;
nut=0.3;
Eb= 290.482e9;
nub=0.063;
then I call the function as :
MakeVar(tf,Et,nut,Eb,nub)
then , in the function m-file I define it like this :
function MakeVar(tf,Et,nut,Eb,nub)
fprintf(fid,'p1 = %0.12f\n',p1);
fprintf(fid,'q = %0.12f\n',q);
fprintf(fid,'tf = %0.12f\n',tf);
fprintf(fid,'tb = %0.12f\n',tb);
fprintf(fid,'tw = %d\n',tw);
fprintf(fid,'teta = %d\n',teta);
fprintf(fid,'d0 = %0.12f\n',d0);
...
The rest doesn't matter , just the same for all the parameters
I would like to ask you to try it , on your matlab
my question is , before , I was not putting any parameters in the parenthesis of makevar()but Matlab was giving me error
the strange thing was that it was not sensitive on p1 , but when it wanted to write tf , giving me error that tf is not defined , so I had to include it in the function parenthesis , I don't know it's output in this figure or input ?? cause the main shape of the function is :
function [y1,..,ym] = func(x1,..,xn)
and mine doesnt look like this one , So I need to do it without these strangely setting some of the parameters and not setting some , because I might need to change the names or number of them , so I don't want to check it every time
thank you so much
Accepted Answer
More Answers (0)
Categories
Find more on Entering Commands in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!