This file contains 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
c = cell([m n]) | |
s = struct('field1', c,... | |
'field2', c,... | |
'field3', c) | |
for i=1:m | |
for j=1:n | |
s(m,n).field1 = 123; | |
s(m,n).field2 = 234; | |
s(m,n).field3 = 567; |
This file contains 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
funtion out1 = func1(arg1, arg2, varargin) | |
% function out1 = func1(arg1, arg2) | |
% function out1 = func1(_____, 'param1', value) | |
% function out1 = func1(_____, 'param2', value) | |
ni = length(varargin); % ni >= 1 | |
DataInputs = 0; | |
PNVStart = 0; % index of the first parameter in varargin |
This file contains 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;clc; | |
testCase = Test; % Test is matlab.unittest.TestCase subclass | |
testCase.forInteractiveUse; |
This file contains 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 TF = iscolorspec(colorSpec) | |
% TF = iscolorspec(colorSpec) | |
% | |
% Return true if coloarSpec is a valid coloarSpec | |
% | |
% http://mathworks.com/help/releases/R2014a/matlab/ref/colorspec.html | |
TF = ~isempty(colorSpec) && isrow(colorSpec) ... | |
&& isnumeric(colorSpec) ... | |
&& length(colorSpec) == 3 && all(colorSpec >= 0 & colorSpec <= 1) ... |
This file contains 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
S1=`defaults read com.apple.finder AppleShowAllFiles` | |
C1='defaults write com.apple.finder AppleShowAllFiles -boolean' | |
# spaces within brackets are important | |
if [[ $S1 == '1' ]]; then | |
$C1 false | |
elif [[ $S1 == '0' ]]; then | |
$C1 true | |
else | |
# does not exist |
This file contains 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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<!-- | |
Spike2 language module for BBEdit | |
Kouichi C. Nakamura, PhD, Kyoto University | |
16 June 2015 | |
kouichi.c.nakamrua@gmail.com | |
Based on |
This file contains 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
%% To sort A in the same order as B (A and B have the same elements but not in the same order) | |
A = [5 4 1 2 3 6]; | |
B = [1 2 4 5 3 6]; | |
[~, sort1] = sort(B); | |
[~, rev1] = sort(sort1); | |
[~, sort2] = sort(A); | |
C = A(sort2(rev1)) |
This file contains 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
left = 2; | |
bottom = 2; | |
width = 8; | |
height = 11; | |
set(gca, 'Units', 'centimeters', 'Position', [left, bottom, width, height]); | |
print('filename1.eps','-depsc') % save as color EPS |
This file contains 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
',(?=\w)' % detect comma not followed by a space with regular expression | |
'$' % end of a word or line |
This file contains 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
X % row vector for X axis | |
themean % row vector for mean value | |
theerror % row vector for STD or SEM | |
% X, themean, and theerror must have the same length. | |
colorspec = 'g'; | |
figure; | |
hold on; |
OlderNewer