Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
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 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (0)
Diese Frage ist geschlossen.
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!