how to import average specific data from excel file ?

조회 수: 1 (최근 30일)
Engineer Batoor khan mummand
Engineer Batoor khan mummand 2020년 10월 21일
HI all:
i want to import average of each day from above excel file but average of those values which is greather than 200.
this is my code but when i run this code it give me below error.
thanks
clc;
clear all;
close all;
[~,Num,Data]=xlsread('solar02.xlsx');
%Average values greater than zero
Average = mean(Data(2:end,3)>0);
Error
Undefined operator '>' for input arguments of type 'cell'.
Error in babab (line 7)
Average = mean(Data(2:end,3)>0);
>>

채택된 답변

drummer
drummer 2020년 10월 21일
Your Data(2:end, 3) is cell type.
You can convert your Data column to array before.
arrayData = cell2mat(Data2:end, 3));
Then, you perform your average with your condition
average = mean(arrayData>0);
Cheers.
  댓글 수: 1
Engineer Batoor khan mummand
Engineer Batoor khan mummand 2020년 10월 21일
thanks problem solved but it gives me nan at the answr but i want average of each day which is given in excel file ...
thanks

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

추가 답변 (0개)

카테고리

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

태그

제품


릴리스

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by