How do I open a new file for writing?
4 ビュー (過去 30 日間)
古いコメントを表示
I've already created the code needed for this part:
%Part A
clear all; clc;
tempdata = fopen('rec0506a.dat','r') ;
fgetl(tempdata);
fgetl(tempdata);
T = fscanf(tempdata, '%*f%f%f%f ',[3,inf])';
fclose(tempdata);
%Part B (means)
clc;
format shortg
sensormean= mean(T) ;
hourlymean = mean(T')' ;
%Part C (Table)
clc;
overallmean = (mean(sensormean) + mean(hourlymean))./2;
t = 1:8;
fprintf('hour T1 T2 T3 | means \n------------------------------------------------- \n')
fprintf('%2d %5d %4d %1d | %4.1f \n',[t',T,hourlymean]')
fprintf('--------------------------------------------------- \n')
fprintf('means = %2.1f %8.1f %7.1f | %6.1f \n',[sensormean,overallmean]')
How exactly do I do this part though? It's confusing me.
D) Open a new file for writing, say rec0506b.dat. Using again at most five fprintf commands, save the above table of Part (c) in the new file, then close the file and upload it on sakai together with the rest of your recitation work.
0 件のコメント
採用された回答
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Environment and Settings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!