fork download
function m = g(m, n)
	m = [repmat('*', 1, numel(m)); m];
	m(:, n) = flip(m(:, n));
end
g('def', 2)
g('def', [1 3])

h = @(m, n) cell2mat(arrayfun(@(c, i) {['*'; c] [c; '*']}(1 + any(i == n)), m, 1:numel(m)));
h('ghi', 2)
h('ghi', [1 3])
Success #stdin #stdout 0.25s 411840KB
stdin
Standard input is empty
stdout
ans =

*e*
d*f

ans =

d*f
*e*

ans =

*h*
g*i

ans =

g*i
*h*