Matlab - creating a single dimensional array from two dimensional parts?

Matlab, as you know, indexes from 1 so you will need to add 1 to the index 0,1,2 to get the row identifier for h. So if the input is 'index j = h(index+1,:) Then, for the next index j = j h(index+1,:) and so on Regards Mark.

Matlab, as you know, indexes from 1 so you will need to add 1 to the index 0,1,2 to get the row identifier for h. So if the input is 'index' j = h(index+1,:) Then, for the next index j = j h(index+1,:) and so on. Regards Mark.

Mark it seems that it takes the values one bye one, not one row at once...? – kl. Jan 26 '10 at 18:11 You're right, I mistyped the code, I've now corrected it to take the whole row. Sorry about the confusion, – gh Performance Mark Jan 26 '10 at 19:12 thanks!

Thanks! – kl. Jan 28 '10 at 0:51.

If the incoming value is x, you could do something like: g = h. ' j = g(1:(x+1)*size(h,2)).

I used MatLab at my old job, but don't have it installed on my current computer, so I couldn't check this for you . . .

But there should at least be something close to that that works. – Tim Goodman Jan 26 '10 at 17:59 I did the following h=0,1,1,1;0,0,0,0;1,1,1,1; then j=h(1:0*size(h,2)); j = Empty matrix: 1-by-0 – kl. Jan 26 '10 at 18:02 I fixed the index stuff, now doing from start it seems to work, but after j = g(1:3*size(h,2)) if next incoming value is 1 my j has only 4 values... – kl.

Jan 26 '10 at 18:09 I set it up so x=1 is the first row, x=2 the first two rows . . .

So j will only have 4 values for x=1, 8 values for x = 2, etc. You could replace x with (x+1) if you want 0 to mean "first row", 1 to mean "first two rows", etc. – Tim Goodman Jan 26 '10 at 18:23 In fact I just changed x to (x+1) in my answer .. . Now I believe it should match what you want. – Tim Goodman Jan 26 '10 at 18:28.

Try this (with x as your vector of incoming values): j = reshape(h(x+1,:). ',1,); The above uses x+1 as an index to select copies of the rows, then transposes and reshapes the result into a single row vector. Here's a test: >> h = 0 1 1 1; 0 0 0 0; 1 1 1 1; >> x = 0 0 0; >> j = reshape(h(x+1,:).',1,) j = 0 1 1 1 0 1 1 1 0 1 1 1.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions