【发布时间】:2018-03-26 12:01:58
【问题描述】:
我有一个依赖于另一个数组的数组(即,我有一个时间数组函数的张力 (V) 数组)。我想找到张力数组中某个元素在特定时刻的位置(即对应于时间向量的特定位置)。我怎样才能做到这一点?
我尝试了以下方法:
VMpzt = max(V);
%find the maximum value of the array of tensions
idxV = find(V == VMpzt);
%find the corresponding index
idxt = t(idxV);
%find the corresponding index of time vector
diff = 0.0048377328;
idxt2 = idxt-diff;
%in fact, I am interested at the index of time that corresponds to this particular position
Vmpzt = V(idxt2); %find the corresponding position of V array
这样做,我得到错误
“数组索引必须是正整数或逻辑值。”
【问题讨论】:
-
你能告诉我们你尝试过的向量和解决方案吗?
-
我尝试了以下方法:
VMpzt = max(V); %find the maximum value of the array of tensions idxV = find(V == VMpzt); %find the correspoding index idxt = t(idxV); %find the corresponding index of time vecotr diff = 0.0048377328; idxt2 = idxt-diff; %in fact, I am interested at the index of time that corresponds to this particular position Vmpzt = V(idxt2); %find the corresponding position of V array这样做,我收到错误“数组索引必须是正整数或逻辑值。”
标签: arrays matlab vector time position