Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
How to make an array that the elements are matrix
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello, I need to do something like a structure where the elements are matrix (3x3):
graph.frontier = [[3x3],[3x3],[3x3],[3x3]]; %and so on
where I would like to append any new element to graph.frontier, so I can use an index to work with it.
I've tryed this:
graph.frontier = [];
initial_state = [7,2,4;5,0,6;8,3,1];
graph.frontier = append(initial_state);
But it didn't work. I'll use this to implement a BFS algo to solve a 8-tile puzzle.
Any ideias?
댓글 수: 0
답변 (1개)
James Tursa
2019년 5월 3일
Maybe use a cell array? E.g.,
graph.frontier = {[3x3],[3x3],[3x3],[3x3]};
You can then get at the matrices with curly braces, e.g. graph.frontier{1}
댓글 수: 3
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!