I’m not certain what you mean by‘not equally spaced’. If they’re not the same lengths, the code changes to:
x=0.01:0.05:0.5;
y=2:2:20;
minlen = min([length(x) length(y)]);
z = [x(2:2:minlen)' y(2:2:minlen)'];
This of course assumes that‘x’ and‘y’ are vectors. If they are matrices, you need to use thesize function instead oflength, specifying the dimension you want to use to specify the length,1 for row length and2 for column length.
If you want to choose a different step (here the step is2), you would have to make the appropriate changes to the code to be sure the vectors are equal length, or use acell array. Thecell array would likely be easier.
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
0 Comments
Sign in to comment.