フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

I have a matrix of values, but get an error when applying the matrix to a function, that the matrix is not an Array

1 回表示 (過去 30 日間)
hde
hde 2012 年 3 月 9 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I have made up a number of columns of data (including columns of zero data) and saved the output into a variable, which when I display it, looks like a matrix, as I wish it to.
When I try to apply the matrix to a function I get the error:
??? Attempt to reference field of non-structure array.
I am aware that this question has been asked many times, but have not seen a solution that I understand.
-
The code I used to generate my matrix was:
-
fid = fopen('u001_s01_sign_ds2-tb-0c_03.svc','r');
data = textscan(fid,'%f %f %f %f %f %f %f','HeaderLines',1);
fclose(fid);
B=[data{3} data{1} data{2} data{7} data{4} data{5} data{6}];
x=zeros(length(B),1);
D=[data{3} data{1} data{2} data{7} x data{4} x x x data{5} data{6} x x x x];
So I am accessing data from a file, rearranging the columns and adding in columns of zero. This then puts the data in the right format for the function to work:
>>C=myfunction(D,1)
The function structure input is as follows:
MYFUNCTION(SAMPLE_POINTS,SEGMENTATION_METHOD)
Where segmentation=1 or 0.
When I checked to see what type my variable D was I got the following:
>> whos D
Name Size Bytes Class Attributes
D 150x15 18000 double
Can anyone provide any insight as to why Matlab says that I am trying to reference a field of non-structure array when I type myfunction(D,1)?
  2 件のコメント
Tom
Tom 2012 年 3 月 9 日
is the error message at a line in the function?
Walter Roberson
Walter Roberson 2012 年 3 月 9 日
We probably need to see the code for myfunction

回答 (0 件)

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by