Skip to content

Instantly share code, notes, and snippets.

@maruta
maruta / save_figure_with_size.m
Created June 22, 2015 04:57
Save MATLAB figure as image file with specified width and height
% Figure を 1024x768 のPNG形式で
% "fig.png" に保存する例
width = 1024;
height = 768;
set(gcf,'PaperPositionMode','auto')
pos=get(gcf,'Position');
pos(3)=width-1; % なぜか幅が1px増えるので対処
pos(4)=height;
set(gcf,'Position',pos);
print('-r0','-dpng','fig.png');
@maruta
maruta / img2bin.py
Created June 16, 2015 05:21
Script for converting image file to binary file for SSD1351 OLED display
from PIL import Image
import numpy
infile="norain.png"
outfile="norain.bin"
img = Image.open(infile)
print(img.size)
pix= img.load()
@maruta
maruta / AdaFruitSSD1351.cs
Created June 16, 2015 05:09
netduino driver for the color 128x128 OLED display referenced SSD1351
using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
namespace Maruta
{
/// <summary>
/// This class is a driver for the color 128x128 OLED display referenced SSD1351.
/// http://www.adafruit.com/products/1431
@maruta
maruta / gist:1035254
Created June 20, 2011 07:17
SYM2TF: a matlab function which converts symbolic math rationals to transfer function object
function [ tfobj ] = sym2tf( symobj, Ts)
% SYM2TF convert symbolic math rationals to transfer function
if isnumeric(symobj)
tfobj=symobj;
return;
end
[n,d]=numden(symobj);
num=sym2poly(n);