Making a variable size 1D or 2D wave
Sun, 04/18/2021 - 04:39 am
Quick question. I have a 1D wave - wave1. I want to select certain values from wave1 that are smaller than 50 and store them in a new 1D wave-wave2.
Now, I don't know how large wave2 will be since it depends on how many values in wave1 are smaller than 50.
So I want to make wave2 such that its row size is flexible. Kindly advise how to do this.
What I'm doing right now is creating wave2 the same size as wave1, storing values, and deleting all bottom rows that are nans. However, this doesn't feel elegant as a code.
Also, instead of running it in a for loop, I am wondering if there is one-liner conditional statement possible that can accomplish this task.. something that may look smoother like-- wave1[i] < 50 ? wave1[i]=wave2 : wave1