Dar Matlab.. it makes me go ahrr!

I am probably the only person in the world who didn’t know about this trick but I’m so gosh darned thrilled about it that I’m going to share it with you anyway.

WARNING: terrible nerdness ahead, the more sensitive of souls might want to skip this.

technician-smallI had a 60×1 struct called ‘Trial’ in which I had a parameter (Trial.StatorDyn) that I wanted to couple to a <60×236 double> matrix called ‘Stim’ . I thought I’d be smart and make a second matrix  and then add it to Stim.

A = Trial.StatorDyn
Stim = [Stim , A].

This brilliant plan did not work because Trial is a struct;
mood = Argh.
Now I am not one to run for help, I generally sit and glare at my screen, curse a bit and then cry myself to sleep. Luckily I had gone to a colleague before this mechanism kicked in and he showed me how mind-runningly easy the solution was. The answer is (insert pause for suspense); brackets.
Yep just plain old brackets. Or if you want to be fancy about it you can use vertcat.

A = vertcat(Trial.StatorDyn); or even just A = [Trial.StatorDyn];
Stim = [Stim,A];

Right. Sigh. Bang Head. Start Again.

This entry was posted in Uncategorized. Bookmark the permalink.

One Response to Dar Matlab.. it makes me go ahrr!

  1. Flora says:

    what are you talking about???????

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s