Insert element in to array and resize.

I have four part of data for chart drafting: T(t) and T3(t1)
t T t1 T3
0 20,25 0 20,25
0,1 20 0,05 19,75
0,2 19,75 0,1 19
0,3 19,25 0,15 17,5
"t" have 0,1 tick but "t1" have 0.05 tick. I want sort the data in loop like this:
t T t1 T3
0 20,25 0 20,25
0,05 NaN 0,05 19,75
0,1 20 0,1 19
0,15 NaN 0,15 17,5
0,2 19,75 0,2 15,75
0,25 NaN
0,3 19,25
arrayThat means, that i must insert a row between every 2 rows in t and T and add data. Anyone have any idea how I can do it?

 采纳的回答

I find the solution on "for" loop many time ago:
T01 = zeros(299, 1);
T11 = zeros(299, 1);
T21 = zeros(299, 1);
for i = 1:1:150
T01(2*i-1) = T(i);
T11(2*i-1) = T1(i);
T21(2*i-1) = T2(i);
end
for i = 1:1:299
if T01(i) == 0
T01(i) = NaN;
T11(i) = NaN;
T21(i) = NaN;
end
end

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by