Read data from a file

조회 수: 2 (최근 30일)
Lauren Smith
Lauren Smith 2017년 3월 7일
편집: Jan 2017년 3월 7일
I am having trouble with a Cody Coursework problem. It reads:
'You are given a text file called "Random_Data.txt". The very first line of the file contains only 1 number. This number indicates how many vectors are stored in this file. Every vector in this file is 1 x 5. Write a script that will add up all of the vectors in this file and save your answer in a variable called "Total".'
It must be a script and not a function. I have tried fscanf, but am not sure how to use it.
Thanks!
  댓글 수: 1
Jan
Jan 2017년 3월 7일
편집: Jan 2017년 3월 7일
Then please post your code. Otherwise it is hard to help you without presenting the full solution. The usage of fscanf is explained in the docs: doc fscanf. What is not clear after reading this?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Other Formats에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by