Expected one output from a curly brace or dot indexing expression, but there were 4 results.

6 ビュー (過去 30 日間)
Diego Argueta
Diego Argueta 2020 年 2 月 21 日
編集済み: Stephen23 2020 年 2 月 21 日
Im not sure what im doing wrong. I wanted to assign those arrays to the first row and first column of the 5x5 cell array but i keep getting error

回答 (1 件)

Bhaskar R
Bhaskar R 2020 年 2 月 21 日
Could you specify, what are you trying to do?
The error because of punneeSquare of size 5x5 and you are trying to assign one value to four locations at a time that too in coma seperated outputs. If you are intended to apply
punneeSquare{1, 2:5} = paren1Genes % first row 2, 3, 4, 5 columns total four locations but you are trying to assigning one value to 4 locations
  5 件のコメント
Diego Argueta
Diego Argueta 2020 年 2 月 21 日
Thank you. What i am looking to create is a cell array of 5x5. Then i want the 1x4 array from p1Genes to be assigned row 1 in locations 2,3,4,5. and the same for p2Genes but i want that one in column two. So i guess im trying to assign the arrays locations in the cell array
Bhaskar R
Bhaskar R 2020 年 2 月 21 日
punnettSquare = cell(5);
"i want the 1x4 array from p1Genes to be assigned row 1 in locations 2,3,4,5" - it is okay
punnettSquare(1, 2:5) = p1Genes;
"same for p2Genes but i want that one in column two" - ??
punnettSquare(2:5, 2) = p2Genes

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by