フィルターのクリア

Attempt to reference field of non-structure array

48 ビュー (過去 30 日間)
Syed
Syed 2013 年 7 月 18 日
編集済み: Joshah Magdalene 2020 年 2 月 9 日
Hi,
I'm trying to run some raw data through a piece of matlab code and for some reason it's coming up with this error
"Attempt to reference field of non-structure array"
The data set had a quotation marks around each row of data, for example
  • "1, .4314, 15314, 000,"
  • "2, .4464, 14135, 322,"
which I had to remove because it was giving me a different error (something along the lines of can't read that data).
Here are the lines which are causing the error
  • 15 load Spec1M2B.txt
  • 16 Time_1 = Spec1M2B.txt(:,2);
and here is the error message
  • Error in PermeabilityTest111011 (line 16)
  • Time_1 = Spec1M2B.txt(:,2);
the .m file is called PermeabilityTest111011, and the .txt file it's calling to get the data is called Spec1M2B.txt.
The rest of the code is not that complicated, it takes the columns and then graphs them, but I need to get through this step to figure out what's wrong. If you think I should upload the .m and .txt files please let me know and I will do so. Thank you very very much.

採用された回答

Evan
Evan 2013 年 7 月 18 日
編集済み: Evan 2013 年 7 月 18 日
You need to remove ".txt.", as your test file isn't loaded in as a structure and Matlab is interpreting the period as referencing a struct. The way you're loading you data, it should come in as Spec1M2B instead of Spec1M2B.txt.
Basically, in matlab, a period isn't just another character that can be used in a variable name.
Does this fix it?
load Spec1M2B.txt
Time_1 = Spec1M2B(:,2);
  1 件のコメント
Wagner
Wagner 2014 年 6 月 15 日
Hi, I am having the same problem but I don't have the .txt at the end. here is the line with the error:
Error in run2 (line 17)
plot(temp.data(:,5),temp.data(:,3));

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

その他の回答 (3 件)

Syed
Syed 2013 年 7 月 18 日
Clearly I am a noob. It fixed it! Thank you so so very much Evan!
  2 件のコメント
Evan
Evan 2013 年 7 月 18 日
編集済み: Evan 2013 年 7 月 18 日
Haha, no worries! And don't forget to hit "Accept" on this answer so that this thread will be sorted in with the resolved questions.
John
John 2015 年 3 月 31 日
I have the same error in my simulation. This is the error;
Attempt to reference field of non-structure array.
Error in LTE_init_load_BLER_curves (line 25) BLER_data = load(LTE_config.BLER_curves.filenames{cqi_idx},'simulation_results','BLER','SNR');
Error in LTE_sim_main (line 7) [ BLER_curves, CQI_mapper ] = LTE_init_load_BLER_curves;
I will appreciate any help. Thank you very much.

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


Joshah Magdalene
Joshah Magdalene 2020 年 2 月 9 日
編集済み: Joshah Magdalene 2020 年 2 月 9 日
I too have the same error.
Attempt to reference field of non-structure array.
I find this error in the below line of my code.
index = int32(pose.subset(j))+1;
I will be grateful if it is sorted out. Thank You!

Soroush Asarzadeh
Soroush Asarzadeh 2016 年 2 月 18 日
編集済み: Soroush Asarzadeh 2016 年 2 月 18 日
Hi, I have a new question in the same topic. I want to add some numerical items to a popup menu according to the number of rows of a matrix named 'Top'. For example if Top has 5 rows, it has to add 5 items (1;2;3;4;5) to it, here is my code but it doesn't seem to work! can anybody help me?
here is the error: Attempt to reference field of non-structure array. Error in MainForm>popupmenu_NodeE_CreateFcn (line 383) Top=handles.Top;
Code:
function pushbutton_LoadExcel_Callback(hObject, eventdata, handles)
Top=xlsread('abc.xlsx',1)
handles.Top=Top;
guidata(hObject,handles);
function popupmenu_NodeE_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
Top=handles.Top;
for i=1:size(Top,1)
set(hObject,'String',[get(hObject,'String');i])
end

カテゴリ

Help Center および File ExchangeCalendar についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by