CELL2MAT does not support cell arrays containing cell arrays or objects.

5 ビュー (過去 30 日間)
fang jie
fang jie 2022 年 1 月 16 日
回答済み: Rik 2022 年 1 月 16 日
when I run CBPSpikesort (code) example,cbp_spikesort_demo_script.m, on 188 line
if (params.general.plot_diagnostics)
AmplitudeThresholdGUI(spike_amps, spike_times, amp_thresholds, ...
'dt', data_pp.dt, ...
'f', figure(params.plotting.first_fig_num+6), ...
'wfnorms', cellfun(@(wf) norm(wf), init_waveforms), ...
'location_slack', params.postproc.spike_location_slack);
end
Function AmplitudeThresholdGUI error. And I find that this error due to cell2mat function
if length(varargin) == 1, ax = varargin{1};
else ax = cell2mat(varargin); end
Error using cell2mat (line 52)
CELL2MAT does not support cell arrays containing cell arrays or objects.
varargin is a 1x2 cell with two 1x1 Axes. I dont know how to solve this problem.

回答 (1 件)

Rik
Rik 2022 年 1 月 16 日
I would suggest using this instead of the entire if statement:
ax=[varargin{:}];
This will happily accept empty inputs, while your code would probably intend to throw an error. If you want an error, check for empty cells.

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by