sequential files(write, read ,append)?
古いコメントを表示
I'm having trouble understanding why my program wont work. I'm given an array of numbers. This is what i should be getting
45 66 78 23 41 55 88 66 99 24 74 88 -these should be in a vertical column
The number of lines of the integers is 12.
The max number is 99 in line 9.
The min number is 23 in line 4.
Heres what i have:
fid1=fopen('hw9.txt','w');
for x=[45 66 78 23 41 55 88 66 99 24 74 88]
fprintf(fid1,'%g\n',x);
end
fclose(fid1);
fid1=fopen('hw9.txt','r');
[numbers count] = fscanf(fid1,'%d');
[value index]=max(x);
[value2 index2]=min(x);
fclose(fid1);
disp(numbers)
fprintf('The number of lines of intergers is %g.\n',count)
fprintf('The max number is %g in line %g.\n',value,count)
fprintf('The min number is %g in line %g.\n',value2,index2)
Is the max function counting most common numbers?
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Whos についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!