latsq(N)

版本 2.0.0.0 (2.1 KB) 作者: Jos (10584)
Latin Square Matrix
3.6K 次下载
更新时间 2017/12/1

查看许可证

latsq - Latin Square
M = latsq(N) creates a latin square of size N-by-N containing
the numbers 1 to N. N should be a positive integer.

A latin square of size N is a N-by-N matrix filled with N different
numbers in such a way that each number occurs exactly once in each row
and exactly once in each column. They have applications in the design
of experiments. The output M is also known as the (backward shifted)
circulant matrix of the vector 1:N.

Examples:
M = latsq(4) % ->
% 1 2 3 4
% 2 3 4 1
% 3 4 1 2
% 4 1 2 3

% latin square of categories
C = {'goat','cabbage','wolf'}
idx = latsq(numel(C))
M = C(idx)

% Randomized latin square
V = randperm(6)
M = V(latsq(numel(V)))

See also magic, gallery,
ballatsq, circulant, slm (file Exchange)

More information: http://en.wikipedia.org/wiki/Latin_square

引用格式

Jos (10584) (2024). latsq(N) (https://www.mathworks.com/matlabcentral/fileexchange/12315-latsq-n), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2017b
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Industrial Statistics 的更多信息
致谢

启发作品: latin cube

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
2.0.0.0

added some additional help ; removed second output

1.1.0.0

updated hellp

1.0.0.0

fixed error in randomization