create matrix from other two matrices
Show older comments
Hello
i have matrix
tem_n1 = (1224,1) and
tem_n2= (459 ,1),
i need to do matrix temperature (1683,1) by taking the first 7 rows in matrix tem_n1, 4 rows in matrix tem_n2..
i already created temp is (11,1) i do not know how to proced and get temperature (1683,1)
[n5,m5]=size(tem_n1);
a5=1:n5;
ind5=find(and(mod(a5,1224)<8,mod(a5,1224)>0));
tem_m1 =tem_n1(ind5,1);
[n6,m6]=size(tem_n2);
a6=1:n6;
ind6=find(and(mod(a6,459)<5,mod(a6,459)>0));
tem_m2 =tem_n2(ind6,1);
tem_m = [tem_m1; tem_m2] ;
4 Comments
dpb
on 28 Jul 2019
How about illustrating with a small section of the data what it is you're actually trying to do.
1683 is total numel() of the two but it's not at all clear how the 7 and 4 are really supposed to play into building the desired end result.
Altho taking a guess, is the intent to splice 7 elements of tem_n1 followed by 4 elements from tem_n2 until you run out of data (because neither array is divisible by the factor)?
More difficult than that is that
>> n5/7
ans =
174.8571
>> n6/4
ans =
114.7500
>>
so you have 60 more pieces of 7 elements each in tem_n1 than you have pieces of 4 in tem_n2.
How supposed to deal with that???
However,
>> n6/3==n5/8
ans =
logical
1
>>
so if you could live with 8 and 3 to make the 11, things would work out much neater...
rana mamdouh
on 28 Jul 2019
But neither of the two arrays is divisible by 7 or 4...and as above, there's a large discrepancy between the number of sets of 7 vis a vis 4 you can do with the two arrays...
Can't do what you say you want...
>> n5/153
ans =
8
>> n6/153
ans =
3
>>
aren't 7 and 4 but 8 and 3.
rana mamdouh
on 29 Jul 2019
Accepted Answer
More Answers (0)
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!