表示日期和月份的一些参数

发布于 2024-09-30 03:03:22 字数 718 浏览 0 评论 0原文

您能帮我解决这件事吗?

我有 3 个矩阵,P(功率)、T(温度)和 H(湿度),

每个矩阵有 31 列(天),每列有 24 行,

这是 2000 年 3 月的数据,即

例如,矩阵 P 有 31 列,其中每列代表

Power 24 小时内的一天数据,同样的想法也适用于 T 和 H

我试图编写一个 MATLAB 程序来实现我的目标,但

它给了我错误。

我的目标是:

在MATLAB命令窗口中,程序应该询问用户以下短语:

Please Enter the day number of March, 2000 from 1 to 31:

我知道它如下:

Name=input(请输入日期2000 年 3 月的编号,从 1 到 31:)

然后,例如,当输入数字 5 时,显示的结果是包含以下内容的矩阵:

第一列:日期名称或可以用数字表示

第二列:简单1到24的数字代表当天的小时数

第3列:从原始P中提取当天P的24个点 (原P的第5列)

第4列:从原T中提取当天T的24个点 (原T的第5列)

第5列:从原H中提取当天H的24个点 (原 H 的第 5 栏)

任何帮助将不胜感激,

问候

Could you please help me for this matter?

I have 3 matrices, P (Power), T (Temperature) and H (Humidity)

every matrix has 31 columns (days) and there are 24 rows for every column

which are the data for the March of year 2000, i.e.

for example, the matrix P has 31 columns where every column represents

a day data for Power through 24 hours and the same idea is for T and H

I tried to write a MATLAB program that accomplish my goal but

It gave me errors.

My aim is:

In the MATLAB command window, the program should ask the user the following phrase:

Please enter the day number of March, 2000 from 1 to 31:

And I know it is as follows:

Name=input (Please enter the day number of March, 2000 from 1 to 31:)

Then, when, for example, number 5 is entered, the result shown is a matrix containing the following:

1st column: The day name or it can be represented by numbers

2nd column: simple numbers from 1 to 24 representing the hours for that day

3rd column: the 24 points of P of that day extracted from the original P
(the column number 5 of the original P)

4th column: the 24 points of T of that day extracted from the original T
(the column number 5 of the original T)

5th column: the 24 points of H of that day extracted from the original H
(the column number 5 of the original H)

Any help will be highly appreciated,

Regards

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

吃不饱 2024-10-07 03:03:22

这就是您的要求:

% some sample data
P = rand(24,31);
T = rand(24,31);
H = rand(24,31);
% input day number
daynum=input('Please enter the day number of March, 2000 from 1 to 31: ');
[r, c] = size(P);
% generate output matrix
OutputMatrix = zeros(r,5);
OutputMatrix(:,1) = repmat(weekday(datenum(2000,3,daynum)),r,1);
OutputMatrix(:,2) = 1:r;
OutputMatrix(:,3) = P(:,daynum);
OutputMatrix(:,4) = T(:,daynum);
OutputMatrix(:,5) = H(:,daynum);
disp(OutputMatrix)

矩阵可以在一行中生成,但这种方式更清晰。

总是 2000 年 3 月吗? :) 你从哪里得到这些信息?

Here is what you ask for:

% some sample data
P = rand(24,31);
T = rand(24,31);
H = rand(24,31);
% input day number
daynum=input('Please enter the day number of March, 2000 from 1 to 31: ');
[r, c] = size(P);
% generate output matrix
OutputMatrix = zeros(r,5);
OutputMatrix(:,1) = repmat(weekday(datenum(2000,3,daynum)),r,1);
OutputMatrix(:,2) = 1:r;
OutputMatrix(:,3) = P(:,daynum);
OutputMatrix(:,4) = T(:,daynum);
OutputMatrix(:,5) = H(:,daynum);
disp(OutputMatrix)

The matrix can be generated in a one line, but this way is clearer.

Is it always for March 2000? :) Where do you get this information from?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文