ismember function with nested arrays

I am trying to determine if a list from an excel file (selected_signals) exists in the a more complete list ( list_of_signals).
The second list has nested arrays in it and is a sort of hierarchy. For example there is one column for a string name and then another column for an array that contains more information. If you go into to the nested array the same thing will be seen (one column for a string name and another for another nested array). This will eventual stop when there is no longer a second column for an array because it is the end of the naming hierarchy.
Can you use the ismember function with arrays that have nested arrays?
Thank you!
The selected signals array is a 2D array:
B={'AS1A','_00_AR'}
The list of signals array could be something like this but with more entries:
A={ {'AS1A', { {'_00_AR', {'LABEL06'; 'LABEL07'} }}}; {'AS1B', { {'_00_AR', {'LABEL06'; 'LABEL07'} }}}}
Code:
NRTS = handles.NRTS;
list_of_signals = NRTS.list_of_model_outputs;
if ismember(selected_signals, list_of_signals)
handles.NRTS = NRTS
set(handles.lb_selected_signals, 'String', selected_signals);
h = msgbox('This is a valid output choice','Valid Output');
else
handles.NRTS = NRTS
msg = ['One or more of the selected output is invalid. '];
h = errordlg(msg,'Invalid Output');
end

댓글 수: 5

Matt Fig
Matt Fig 2012년 10월 10일
Can you construct a sample array so we can see what is going on? It can be real simple and short, but should capture the salient features...
Benjamin
Benjamin 2012년 10월 10일
Hopefully that helps?
I do not understand any line of your example.
‘_00_ARINC_OUT| 124x1cell
Is "|" an OR-operator, an optical separator, or what?
Please post some valid Matlab code like:
A = {{1,2,3}, {'asd', 'bsd'}; 15, struct('a', 'b')}
Matt Fig
Matt Fig 2012년 10월 10일
I second Jan's comment. Post some valid MATLAB code we can copy and paste. The code can be short and simple, yet it should accurately represent the salient features of your data...
Benjamin
Benjamin 2012년 10월 10일
편집: Benjamin 2012년 10월 10일
That is fair. I have added two arrays above. They would only differ in that there would be more entries in each.
Calling ismember(B, A) gives me the error "Input must be cell arrays of strings." I assume this is due to some of the cells being arrays. Is there a work around?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Dates and Time에 대해 자세히 알아보기

태그

질문:

2012년 10월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by