Dimensions of arrays being concatenated are not consistent.

9 ビュー (過去 30 日間)
Luca Re
Luca Re 2024 年 4 月 10 日
コメント済み: Image Analyst 2024 年 4 月 10 日
hi, i receive this error...How can i solve it?
arr = load('matlab_bb.mat')
arr = struct with fields:
bb: {76x1 cell}
disp(arr.bb)
{'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Mini' } {'On Mini' } {'On Mini' } {'On Mini' } {'On Mini' } {'On Mini' } {'On Mini' } {'On Mini' } {'On Mini' } {'On Mini' } {'On Mini' } {'On Mini' } {'On Mini' } {'On Mini' } {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'} {'On Micro'}
cell2mat(arr.bb)
Error using cat
Dimensions of arrays being concatenated are not consistent.

Error in cell2mat (line 83)
m{n} = cat(1,c{:,n});
cell2mat(bb)
Error using cat
Dimensions of arrays being concatenated are not consistent.
  13 件のコメント
Luca Re
Luca Re 2024 年 4 月 10 日
thank ..good explanation
Image Analyst
Image Analyst 2024 年 4 月 10 日
@Luca Re see the FAQ for a good explanation of a cell array:
It explains how and when to use curly braces, square bracket, or round parentheses. I think it will help you get a good intuitive feel for when to use each.

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

回答 (1 件)

Ramtej
Ramtej 2024 年 4 月 10 日
Hi,
Assuming you are triying to convert cell array of characters into string array.
You can use "string" function for your case as shown below.
stringMatrix = string(arr.bb)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by