Skip to content

Instantly share code, notes, and snippets.

View andrewmwoodward's full-sized avatar

Andrew W andrewmwoodward

View GitHub Profile
@andrewmwoodward
andrewmwoodward / TOFSdetection.ino
Last active February 19, 2019 14:43
a step counter using an arduino nano and gyro sensor
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_L3GD20_U.h>
// Assign a unique ID to this sensor at the same time
Adafruit_L3GD20_Unified gyro = Adafruit_L3GD20_Unified(20);
int THRESHOLD = 4000; // likely needs adjustment
int FLAG = 0;
unsigned long stepCount = 0;
@andrewmwoodward
andrewmwoodward / drawCell.m
Created November 23, 2018 15:25
Plots a filled bacteria cell with a given length, width, position, angle, and color onto a specified or the current figure axis
function handle = drawCell(POSITION, LENGTH, WIDTH, ANGLE, COLOR, varargin)
% drawCell - plots a filled bacteria cell with a given length, width, position, angle, and color
%
% Inputs:
% POSITION - coordinates of the cell centroid [x y]
% LENGTH - length of the cell (um)
% WIDTH - width of the cell (um)
% ANGLE - orientation of the cell in radians
% COLOR - color of the cell (rgb triplet)
% varargin - used to input the current axis hangle if given
figure
% define the first axis
ax1 = axes('Position',[0.1 0.1 0.8 0.8], 'Box','off');
% read the image file
I = imread('dog.jpeg');
% display the image
img = imshow(I);
% create the arbitrary data
xData = [1000, 2000, 3000];
@andrewmwoodward
andrewmwoodward / multinucleatedDetect.m
Created November 6, 2018 20:58
Detects multinucleated cells
function multinucleatedDetect()
% Detects multinucleated cells
% prompts user for input file and then detects any multinucleated cell
% sets and output an image with those cells highlighted and a csv file
% with the number of cells and estimated size of multinucleated cell
close all
% approximately 267 based on my counting from main image
% prompt the user for the filename
% create the x y and z axis values
x = zeros(1,50)+0.5;
y = zeros(1,50)+0.5;
z = [0:0.02:1];
% create the figure
figure
hold on
grid on
zlim([0 max(z)]);
function plotSelectionExample( )
% Demonstration to show how to make an interactive selection gui in MATLAB
% Andrew Woodward Fall 2018
f1 = figure; % create the figure
set(f1, 'WindowButtonUpFcn', @mouseUpCallback); % create a click up listener
hold on
% create 3 random plots
for i=1:3
% A simple priority queue that takes arrays as inputs and uses a specific
% column of the 1xN arrays to sort by the minimum value.
%
% Utilizes a minheap to ensure quick operation even with queues with
% > 100,000 elements
%
% Andrew Woodward - Fall 2018
%
% Example uses:
% q = PriorityQueue(1);
#include <Wire.h>
// define the two I2C addresses
const int MPU1 = 0x68;
const int MPU2 = 0x69;
void setup() {
// Setup the two IMUs
Wire.begin();
Wire.beginTransmission(MPU1);
@andrewmwoodward
andrewmwoodward / simpleShadow.m
Last active October 28, 2018 20:34
Simple shadows for scatter3 objects
% randomly generate five axis values
x = rand(1,5);
y = rand(1,5);
z = rand(1,5);
% create the figure without shadows
figure
grid on
zmax([0 max(z)]) % set the z-axis limit