For loop creating a number sequence

조회 수: 7 (최근 30일)
Erik Börgesson
Erik Börgesson 2020년 5월 25일
댓글: Rik 2020년 5월 25일
I am not succeeding in creating a loop that creates the number sequence I want.
The following sequence you see is in matlab one single row. It is telling how to traverse in a 13 x 3 table that I have. What the picture is telling you, from the first row: The first column in the first row, the first column in the second row, ... , the first column in the 13:th row. Then, we have the next combination: The first column of the first row, the first column in the second row, ... , the second column in the 13:th column. It will be 1594323 (13^3) different of these, i.e the last one will be: The 13:th column of the first row, the 13:th column in the second row, ... , the 13:th column in the 13 row.
So, I need a (perhaps) for-loop that will create this sequence for me. If anyone nows how to do this, I would really appriciate the help.
  댓글 수: 1
Rik
Rik 2020년 5월 25일
This is not possible. You could generate each in a for-loop, but it is not possible to create that array:
A=ones(13^13,13);
%return:
Error using ones
Requested array exceeds the maximum possible variable size.
Error in Untitled (line 22)
A=ones(13^13,13);
More information
(this assumes you want all permutations of 1:13)

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by