Attack of the code


Here’s the thing, all code is bad code. Some code is just better than others. For every person who writes a program, there’s someone else who would do it a totally different and, to them, less complicated or confusing way. However, as long as the code you write works, it shouldn’t really matter how badly it’s written, right? To me the difference between bad code and worse code is comments. The frustrating thing about taking apart someone else’s code is that there are rarely enough comments to figure out what the hell is going on.
(more…)Intro to MATLAB – Part 5


Well we’re doing it. We’re adding to the MATLAB course I taught. Today we’re going to dive into functions, more importantly why you may want to write your own function, when you probably don’t need to, and how to tell the difference. This of course was inspired by the stuff I had to do the other day and when I realized I should just stuff everything into a function, life became a lot less complicated. Don’t worry, functions are your friends!
(more…)The value of planning your code


It’s no secret I need to write code, a lot of code. A mind numbingly large amount of code. Researching in a brain-machine interface lab is more about programming than it is about scifi brain hacking or anything the latest techno-thriller movies would have you believe. Anyone can do it, but it takes a certain amount of practice and a whole heck of a lot of time. Over time your skills develop and things get to be easier, but it’s not a linear progression (is anything really?) so things can be frustrating. These days planning saves me tons of time and effort, so today I want to pass that bit of knowledge on to you.
(more…)Programming overreach


This is what happens when I try to get fancy with the work I’m doing. I end up attempting to do things that aren’t done easily or if they are done easily, I figure out the hardest way possible for me to get them done. A week or so ago (here) I was excited because I came up with a super cool way to do something and I thought that the hardest part was behind me. Oh how wrong I was… but I’m close to figuring this out, I just need to do a lot of work to dig out of this hole I threw myself into. This is why you should never do anything fancy!
(more…)Intro to MATLAB – Part 4


We made it! This is the last post (for now anyway) in my four part Intro to MATLAB series. I reserve the right to go back and write more on the topic, but at the moment this is the end. If you’re just finding this and want to read the other posts in the series, I’ve made a super helpful Intro to MATLAB category where they are listed. Today we’re going to take a dive into editing code, finding ways to make your life easier, and just some bits of magic I’ve learned over the years that makes my life so much easier now. Let’s goooooo!
(more…)Intro to MATLAB – Part 3


To debug or not to debug. Just kidding you’re always going to need to debug. My class has officially ended, so this weekend we’re posting the last two parts to the four part Intro to MATLAB series. This lecture I taught my class how to use the debugger in MATLAB to solve any sort of problem they may run into and how to make sense of any issues they had. Unfortunately this means there is no code associated with this class, but we can still go into detail. The best part about being able to debug is that it makes you look like a coding god, so it’s a skill worth learning.
(more…)Intro to MATLAB – Part 2


I’m teaching an intro to MATLAB class and if it’s one thing I hate it’s hording knowledge so I’m sharing it here for all of you to enjoy! If you missed the first part, fear not you can find it here. I’ve also created a special category (the Intro to MATLAB category) where you can find these posts and a whole lot of other things I’ve taught, like my 10 week solid modeling for beginners classes and my incredibly detailed and surprisingly popular, know your spinal cord series (my personal favorite). Okay enough plugging my classes, let’s talk MATLAB.
(more…)Intro to MATLAB – Part 1


Per my usual routine, I’m teaching a class and instead of hording the knowledge I’m putting it here for all of you to use! I’m even going to attach the example code I wrote, which has enough comments to fill a small book, to help everyone just starting out. As I explained to my students, this is an intro to MATLAB course so my focus is on showing how things are done in MATLAB and less on how to problem solve using MATLAB. Although the last two lectures have not been created yet so they may focus on problem solving, who knows.
(more…)The coding hole


Help, I’ve fallen into a coding hole and I can’t get out! Okay, to be fair I actually DID get out, but at the time it felt like there was no hope and I would be trapped banging my head against a wall trying to figure out what I was doing. Today I figure we can discuss how I code and what my idea of a coding hole is, it will be a fun break for me.
(more…)The art of coding


Well I did it. I got all the code written for the next two (of three) steps for processing my data. I can’t do the third until the second step is done for at least one dataset, but I’m almost there and the last bit of code is to visualize the data, which is substantially easier. So let’s talk about what I did and why I won’t have to do it again now.
(more…)