This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function colors = calcColorNum(RGBmat) | |
% RGBmat must be MxNx3 double | |
% Tue Nov 26 18:42:52 2013 Ryosuke Takeuchi | |
L = zeros([size(RGB,1) size(RGB,2)]); | |
colors = squeeze(RGB(1,1,:))'; | |
for r = 1:size(L,1); | |
for c = 1:size(L,2); | |
colorNum = size(colors,1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(add-to-list 'load-path (expand-file-name "~/.emacs.d/elisp/matlab-emacs/")) %パス設定 | |
(autoload 'matlab-mode "matlab" "Enter Matlab mode." t) | |
(setq auto-mode-alist (cons '("\\.m$" . matlab-mode) auto-mode-alist)) | |
(add-hook 'matlab-mode-hook | |
'(lambda () | |
(set-buffer-file-coding-system 'sjis-dos))) %M-ファイルはシフトJISで開く | |
(setq matlab-shell-command "/Applications/MATLAB_R2012a_Student.app/bin/matlab" %bashにパス通しても上手くいかなかったので | |
matlab-indent-level 2 %ここら辺は好みでどうぞ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "Nokogiri" | |
require "open-uri" | |
url = 'http://www.mathworks.co.jp/jp/help/matlab/functionlist.html' | |
doc = Nokogiri::HTML(open(url).read) | |
hoge = doc.css('td.term') | |
fuga = doc.css('td.description') | |
for i in 0..hoge.size-1 | |
puts fuga[i].text |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int DispW = 1280; | |
int DispH = 720; | |
void setup() | |
{ | |
frameRate(30); | |
size(DispW, DispH); | |
//noStroke(); | |
noCursor(); | |
rectMode(CENTER); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def linspace(initVal, last, num) | |
arr = [*initVal..num] | |
arr = arr.collect{|i| i.to_f*last/num} | |
return arr | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function [Citation] = pmid2APA(pmid) | |
%% | |
bufCell=pmid2medlineCell(pmid); | |
%% JNS用 | |
ROIcitation={'AU' 'DP' 'TI' 'TA' 'VI' 'IP' 'PG'}; | |
for i=1:length(ROIcitation) | |
eval(['Cell.' ROIcitation{i} '=strfind(bufCell, ''' ROIcitation{i} ''' );']); | |
eval([ROIcitation{i} '=' '[];']); | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clear all; | |
close all; | |
% PVM1741 Params | |
dp.Dist = 570; | |
dp.Width = 365.8; | |
dp.WidPx = 1920; | |
% calc | |
dp.WidDeg = 2*(atan(0.5*dp.Width/dp.Dist)*180/pi); % Angle of View |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int ir_out = 12; | |
int led = 9; | |
// Original Codefrom http://eikatou.net/blog/2012/07/1796/ | |
// 全明 | |
unsigned int data[] = {347,174,44,44,42,43,43,130,44,132,42,44,41,131,43,44,43,44,43,43,43,131,42,43,43,43,43,130,43,44,43,133,41,43,43,130,43,45,42,43,42,132,43,44,42,43,43,43,44,45,41,43,43,42,45,131,42,130,43,46,41,131,43,46,41,44,42,131,42,45,41,131,42,44,43,43,43,131,42,45,43,43,43}; | |
unsigned int dataWarm[] = {343,173,46,43,40,48,38,133,40,135,38,48,38,136,38,48,40,45,38,48,41,132,41,45,38,48,38,132,41,46,41,135,41,45,38,135,38,48,38,48,38,136,38,133,40,136,38,48,42,44,38,136,38,132,41,48,38,136,38,48,38,48,38,48,38,133,41,48,38,135,38,48,38,48,38,133,40,132,44,42,42,132,44}; | |
unsigned int dataCold[] = {343,179,41,43,43,46,40,132,39,132,41,45,41,131,42,48,40,43,41,48,41,130,41,46,40,46,41,130,44,48,38,132,41,46,41,132,41,46,41,48,38,130,43,133,41,132,41,48,39,45,41,46,41,131,43,45,41,132,41,45,41,46,41,45,41,132,41,132,41,132,41,45,41,45,42,132,41,132,42,48,38,132,41}; | |
int last = 0; | |
unsigned long us = micros |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% Cell masker | |
close all; clear all; | |
rawImg = imread('coins.png'); | |
mask = zeros(size(rawImg)); | |
mask(1:end-1,1:end-1) = 1; | |
% img = medfilt2(rawImg, [0.5 0.5]); | |
img = imsharpen(rawImg); | |
segmentImage(img) | |
%% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function [] = msclab_mat2avi(frames, exportfileName, fps) | |
% function [avifile] = msclab_mat2avi(frames, exportfileName, fps) | |
% function for making moviefile from XxYxTime matrix | |
% Value range should be 0~1. | |
frameVol = size(frames); | |
roi_window = [0 0 size(frames, 1) size(frames, 2)]; | |
disp(['Export "' exportfileName '"...']); | |
disp 'MatrixSize' | |
disp([frameVol]) |
OlderNewer