Load the data into a vector and compute this average using a while loop + Using tic() and toc()

Hello, my name is Paul. I'm a beginner user in MATLAB. One of my courses assign me a problem I should use a while loop (with a text file), and tic() and toc(). Below is what I want to create.
Problem Statement
You are an electrical engineer working with renewable energy. The file ClassSDPprep_watss.txt has the maximum power in Watts required in a house for each day for the month of March. You want to compute the average power requirement for the month of March. You will need to load the data into a vector and compute this average using a while loop. Using tic() and toc() determine how long the program took to run and print the results to the screen.
I attach the text file that is needed to be calculated using a while loop as well as my attempt typing codes.
Appreciate your time and understanding.

답변 (1개)

Undefined function 'Length' for input arguments of type 'double'.
Error in Problem_3_SDP_code (line 14)
while Period < Length(Power)
MATLAB is case sensitive. Length() is considered to be different than length()

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

질문:

2017년 11월 2일

답변:

2017년 11월 2일

Community Treasure Hunt

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

Start Hunting!