Error using cat Dimensions of arrays being concatenated are not consistent.

1 回表示 (過去 30 日間)
Rimsha Muzaffar
Rimsha Muzaffar 2022 年 7 月 30 日
コメント済み: Rimsha Muzaffar 2022 年 7 月 31 日
how to correct this
Error in waveletfssddata (line 42)
Xtrain = cat(2,Xtrain,smat);
Xtrain = [];
scatds_Train = transform(adsTrain,@(x)helperReadSPData(x));
while hasdata(scatds_Train)
smat = read(scatds_Train);
Xtrain = cat(2,Xtrain,smat);
end

回答 (1 件)

Torsten
Torsten 2022 年 7 月 30 日
Xtrain = cat(2,Xtrain,smat.');
would work, I guess.
  3 件のコメント
Torsten
Torsten 2022 年 7 月 30 日
編集済み: Torsten 2022 年 7 月 30 日
smat must always be of size (nx1) in order that you can concatenate Xtrain and smat.' .
Check the size of smat before concatenating in the while-loop.
Rimsha Muzaffar
Rimsha Muzaffar 2022 年 7 月 31 日
smat use helperspread function
function x = helperReadSPData(x)
% This function is only for use Wavelet Toolbox examples. It may change or
% be removed in a future release.
N = numel(x);
if N > 8192
x = x(1:8192);
elseif N < 8192
pad = 8192-N;
prepad = floor(pad/2);
postpad = ceil(pad/2);
x = [zeros(prepad,1) ; x ; zeros(postpad,1)];
end
x = x./max(abs(x));
end
this function also give error at
N = numel(x);
then, what can i do;

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

カテゴリ

Help Center および File ExchangeDiscrete Multiresolution Analysis についてさらに検索

タグ

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by