CAT arguments dimensions are not consistent

1 回表示 (過去 30 日間)
Max Müller
Max Müller 2014 年 8 月 6 日
編集済み: Image Analyst 2014 年 8 月 7 日
Hey Guys, I've a smale Problem with a Listbox.I have created a GUI with a Listbox which has the task to display Names from an Array.The main Problem is, matlab says: CAT arguments dimensions are not consistent.I know what matlab is trying to tell me, but i dont know how to solve it. Here is the Code.
if UsedAmplification == 1
ListboxInput = get(handles.PlotedShotsListbox,'String')
ListboxContent = [num2str(shot),' ','UsedAmplification']
ListboxOutput = [ListboxInput,ListboxContent]
set(handles.PlotedShotsListbox,'String',ListboxOutput)
end
if closestAmplification == 1
ListboxInput = get(handles.PlotedShotsListbox,'String')
ListboxContent = [num2str(shot),' ','ClosestAmplification']
ListboxOutput = [ListboxInput,ListboxContent]
set(handles.PlotedShotsListbox,'String',ListboxOutput)
end

採用された回答

Max Müller
Max Müller 2014 年 8 月 7 日
The trick was:
ListboxContent = {num2str(shot),' ','UsedAmplification'}
so it becomes a String Array or an String Array.

その他の回答 (1 件)

Image Analyst
Image Analyst 2014 年 8 月 6 日
編集済み: Image Analyst 2014 年 8 月 7 日
Try using semicolons, because ListboxInput is a column vector. And it needs to be a cell array. Try either of these:
ListboxContent = {num2str(shot); ' '; 'UsedAmplification'};
ListboxContent = [{num2str(shot)}; {' '}; {'UsedAmplification'}];
which are equivalent to each other, and read this: http://matlab.wikia.com/wiki/FAQ#What_is_a_cell_array.3F

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by