How to read text file using only fopen, fread, fclose

조회 수: 2 (최근 30일)
upol
upol 2018년 2월 17일
답변: upol 2018년 2월 17일
Hi, I need to read this file using only fopen, fread and fclose becasue later I will convert this into C code using matlab coder. Please help
Engine EIHC_TO EIHC_CO EIHC_App EIHC_Idle EICO_TO EICO_CO EICO_App EICO_Idle EINOx_TO EINOx_CO EINOx_App EINOx_Idle FF_TO FF_CO FF_App FF_Idle TFE731-2-2B 0.114 0.128 4.26 20.04 1.394 2.03 22.38 58.6 15.25 13.08 5.9 2.82 0.205 0.173 0.067 0.024 TFE731-3 0.062 0.072 1.41 9.04 1.13 1.62 15.56 47.7 19.15 16.02 6.92 3.72 0.225 0.186 0.072 0.026 AE3007A 0.25 0.29 0.64 2.51 0.75 0.92 3.28 17.35 20.54 17.47 7.79 3.83 0.377 0.315 0.117 0.049 AE3007A1 0.221 0.257 0.655 3.818 0.77 0.96 3.91 23.73 19.66 16.63 7.1 3.47 0.3826 0.318 0.113 0.0461

답변 (1개)

upol
upol 2018년 2월 17일
I use this, but it doesnt work
clear all fid = fopen('icao_emission_databank_simplified.txt'); data=fread(fid,'char'); N = 100; [vals, numRead] = fread(fid, N, '*double'); if numRead ~= N % fewer elements read than expected end fclose(fid);

카테고리

Help CenterFile Exchange에서 Low-Level File I/O에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by