本文介绍了在MATLAB中的Excel似乎不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的matlab文件夹中有一个excel文件,其中包含9列数据.每列都是我公式中的另一个变量.

I have an excel file in my matlab folder containing 9 columns with data. Each column is another variable in my formula.

我想执行以下操作: -将excel中的特定列与matlab中的特定变量相关联: -`%定义变量m1 = xlsread('jongens0','B:B');m2 = xlsread('jongens0','C:C');m3 = xlsread('jongens0','D:D');m4 = xlsread('jongens0','E:E');m5 = xlsread('jongens0','F:F');m6 = xlsread('jongens0','G:G');m7 = xlsread('jongens0','H:H');m8 = xlsread('jongens0','I:I');

I would like to do the following: - associate a specific column in excel with a specific variable in matlab: - `% define variablesm1=xlsread('jongens0','B:B');m2=xlsread('jongens0','C:C');m3=xlsread('jongens0','D:D');m4=xlsread('jongens0','E:E');m5=xlsread('jongens0','F:F');m6=xlsread('jongens0','G:G');m7=xlsread('jongens0','H:H');m8=xlsread('jongens0','I:I');

接下来我计算我的增长函数

Next I calculate my growth function

tmin=0;
tmax=20;
dt=1/100;
t = tmin:dt:tmax;
y = m1.*(1-1./(1+(m2.*(t+m8)).^m5+(m3.*(t+m8)).^m6+(m4.*(t+m8)).^m7));

接下来我计算速度函数(一阶导数)

next I calculate the velocity function (the first derivate)

%velocityfunction
dy=diff(y)./dt;

接下来,我使用以下命令来获取最小和最大速度,以及此时的时间和增长率:

next I use the following commands to obtain the minimum and maximum velocity as also the time and growth at this time:

max(dy);
min(dy) if t<12;
imax = find(dy==max(dy)) + 1;
imin = find(dy==min(dy)) + 1;

t(imax);
t(imin);
y(imax);
y(imin);

如果我在matlab命令窗口中输入此错误,则会出现以下错误:使用+时出错矩阵尺寸必须一致.

If i enter this in the matlab command window i get the following error:Error using + Matrix dimensions must agree.

有人可以指出我做错了什么吗?

Can somebody point me out what I am doing wrong?

谢谢

推荐答案

您要添加大小不同的向量.将t加到m个向量之一时,m个向量的大小是否与t相同?

You're adding vectors that are different sizes. When you add t to one of your m vectors, are the m vectors the same size as t?

您可以输出参与添加操作的所有变量的长度以进行调试.如果这样做不行,请使用size函数. 1xm和mx1矩阵也不会相加.

You can output the length of all your variables that participate in the add operation to debug. If that doesn't do it, use the size function. A 1xm and an mx1 matrix won't add either.

这篇关于在MATLAB中的Excel似乎不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 21:13