how to import average and maximum data from excel sheet .
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
hi all:
i want to import avarege data of each day from above excel file but avarege of that values which is greater than 0.
second i want find greatest average value day in that excel file .
thanks
採用された回答
Sudhakar Shinde
2020 年 10 月 20 日
編集済み: Sudhakar Shinde
2020 年 10 月 20 日
[~,Num,Data]=xlsread('solar02.xlsx');
%Average values greater than zero
Average = mean(Data(2:end,3)>0);
%Maximum
max(Average);
12 件のコメント
thank you so much dear:
i have used your code but it gave me this error .
Undefined operator '>' for input arguments of type 'cell'.
Error in SOLARRR (line 3)
Average = mean(Data(2:end,3)>0);
Sudhakar Shinde
2020 年 10 月 22 日
編集済み: Sudhakar Shinde
2020 年 10 月 22 日
this will also work for you.
[Num,text,Data]=xlsread('solar02.xlsx');
Average=mean(Num>0)
thanks dear:
it will give us average of all the values but i need each day average for all data given excel file .
thanks
as you know we have 365 day in one year so output will be 365 values but average value of each day dear.
thanks
let me explain my problem dear :
i need average of each day i want to take average of those values in each day which is grather than 200.
thanks
Engineer Batoor khan mummand
2020 年 10 月 22 日
編集済み: Engineer Batoor khan mummand
2020 年 10 月 22 日
thanks dear Sudhakar Shind:
i used this code but it gives me average of all values in each day i mean not greather than 200.
[numbers, strings, rawData] = xlsread('solar02.xlsx')
daysOfWeek = strings(2:end, 2);
sequentialDays = ones(length(daysOfWeek), 1);
for k = 2 : length(sequentialDays)
if ~strcmpi(daysOfWeek{k}, daysOfWeek{k-1})
% It's not the same as the prior day so we're starting a new day.
sequentialDays(k:end) = (sequentialDays(k-1) + 1);
end
end
% Get the averages over any and all hours of each day.
dailyAverages = splitapply(@mean, numbers, sequentialDays);
plot(dailyAverages, 'b-', 'LineWidth', 2);
title('Daily Average of Solar Radiation', 'FontSize', 18);
xlabel('Day', 'FontSize', 18);
ylabel('Average over the Day', 'FontSize', 18);
grid on;
but my purpose is that first of all matlab should ignor all those values which are less than 200 and than take average of each day i hope you got my point.
thanks
does this works:
% Get the averages over any and all hours of each day.
dailyAverages = splitapply(@mean, numbers>200, sequentialDays);
hi:
it gives me an error of (' empty double column vector')
thanks
Sudhakar Shinde
2020 年 10 月 22 日
編集済み: Sudhakar Shinde
2020 年 10 月 22 日
This is your area of interest:

%Use below code lines in your code:
Id = (numbers>200);
numbers=numbers(Id);
sequentialDays = sequentialDays(Id);
G = findgroups(sequentialDays);
% Get the averages over any and all hours of each day.
dailyAverages = splitapply(@mean, numbers, G);
Done thank u so much dear from your helping and support.
Sudhakar Shinde
2020 年 10 月 22 日
Welcome. glad to help.
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Data Import and Analysis についてさらに検索
参考
2020 年 10 月 20 日
2020 年 10 月 22 日
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
