フィルターのクリア

I got error, dimesion mismatch, what does this mean? please help

2 ビュー (過去 30 日間)
Brwa
Brwa 2013 年 6 月 7 日
A = zeros(10,10)
A(1,1) = 'Story'
A(1,2) = 'Force'
A(2,1) = 1
A(3,1) = 3
.
.
etc
??? Subscripted assignment dimension mismatch.
Error in ==> Program at 21 my_result(n+2,1) = 'Story'
Im willing to ceate a table which is contain letters or words and numbers, is it possible? if, its possible could you please help me to fix that error message.
I will appreciate your help
Thanks

採用された回答

Andrei Bobrov
Andrei Bobrov 2013 年 6 月 7 日
編集済み: Andrei Bobrov 2013 年 6 月 7 日
Use cell array:
A = cell(10,10)
A{1,1} = 'Story'
A{1,2} = 'Force'
A{2,1} = 1
A{3,1} = 3
A(2:10,2) = num2cell(1:9);
.
.
etc

その他の回答 (2 件)

Walter Roberson
Walter Roberson 2013 年 6 月 7 日
It is not possible to create a numeric array that contains a combination of letters and numeric values. The closest you can get is to use a cell array.
A = cell(10,10);
A{1,1} = 'Story';
A{1,2) = 'Force';
A{2,1} = 1;
A(3,1) = 3;
Notice the use of {} instead of ()

Brwa
Brwa 2013 年 6 月 7 日
編集済み: Brwa 2013 年 6 月 7 日
Thanks Mr Andrei Bobrov and Mr Walter Roberson
I have another problem since some input values are vectors not scalars as you can see bellow
A{2:10,2} = 1:1:9;
its working for
A = zeros(10,10)
A(2:10,2) = 1:1:9;
but now i got error
??? The right hand side of this assignment has too few values to satisfy the left hand side.
Error in ==> Program at 24 A(2:10,2) = 1:1:9;
Thanks
  3 件のコメント
Andrei Bobrov
Andrei Bobrov 2013 年 6 月 7 日
See my answer.
Brwa
Brwa 2013 年 6 月 7 日
Thank you guys, you are so great and kind. both of the answers are the same and they are exactly do what i want do.
Thanks again

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

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by