フィルターのクリア

conversion from double to struct

23 ビュー (過去 30 日間)
God'sSon
God'sSon 2011 年 5 月 16 日
hello,
i am trying to import (x) which is an audio signal and then concatenate with some zeros but get the following error message. can anyone please help.
cheers,
x = uiimport('test_signal.mat')
input_signal=x; B = zeros([1,8]); total_input_signal= [B input_signal];
??? Error using ==> horzcat The following error occurred converting from double to struct: Error using ==> struct Conversion to struct from double is not possible.
Error in ==> output at 10 total_input_signal= [B input_signal];

採用された回答

Andrei Bobrov
Andrei Bobrov 2011 年 5 月 16 日
if the mat - file contains one variable
x = uiimport('test_signal.mat');
names =fieldnames(x);
xx = x.(names{:});
total_input_signal = [zeros(1,size(xx,2));xx];
  1 件のコメント
God'sSon
God'sSon 2011 年 5 月 16 日
thanks.

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

その他の回答 (1 件)

Ivan van der Kroon
Ivan van der Kroon 2011 年 5 月 16 日
if it is a real sound file like
x=load('handel')
x =
y: [73113x1 double]
Fs: 8192
you will have a structure as well. For any set of variables you save and load again, the variables will be behind a structure. To perform array/matrix operations on the sound data in this case, you can think of
total_input_signal=[B ; x.y];
If it is still not clear to you, can you specify what variables youre file test_signal.mat is made up by?
  1 件のコメント
God'sSon
God'sSon 2011 年 5 月 16 日
thanks

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

カテゴリ

Help Center および File ExchangeAudio and Video Data についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by