Professional Documents
Culture Documents
: ) (sample .
)fid=fopen(filename,w
fprintf(fid,format,list
)of variables
3.2
8.5
10.4
1
2.1
6.1
9.3
this is a test
;>>i=1
)) (Matlab
;]>>A=[2.1,3.2,8.5;6.1,9.3,10.4
(
;>>B=this is a test
;)>>filename=input(Enter file name =,s
) (s )(input
Enter file name = sample
) (w ) (fid )(fopen
) (i integer ) (\n .
) (f fixed point 4 1
)(s string
)(fclose
;)>>fid=fopen(filename,w
;)>>fprintf(fid,%i\n,i
;)>>fprintf(fid,%4.1f\n,A
;)>>fprintf(fid,%s\n,B
;)>>fclose(fid
:
) (type )(sample
>>type sample
1
2.1
3.2
8.5
6.1
9.3
10.4
this is a test
: ) (sample .
) (s )(input
) (r ) (fid )(fopen
;)>>fid=fopen(filename,r
) (i integer ) (\n
1
) (f fixed point ) 3
(2
) (s string inf
)(fclose
;)>>AC=fscanf(fid,%i\n,1
;)]>>AB=fsacnf(fid,%f\n,[3 2
;)>>AD=fscanf(fid,%s\n,inf
;)>>fclose(fid
:
>>AB
AB
)
3 (2
6.1
9.3
10.4
>>AB
transpose
8.5
10.4
AC
AD
2.1
3.2
8.5
3.2
9.3
2.1
6.1
>>K=AC+2
K=3
>>AD
this is a test