comparing and updating fields in a structure
2 views (last 30 days)
Show older comments
i have this part of code where i want to do a comparison for a loop of (i) to compare the name SSID then if it is write it have to update the RSSI field
([wifiScanDataStruct.UserData.Dev(i).SSID num2str(wifiScanDataStruct.UserData.Dev(i).RSSI)]) %% the stated structure without updating
([tmp.SSID(1) num2str(tmp.RSSI(1))]) %% the recived values
2 Comments
Walter Roberson
on 18 Feb 2019
That is not clear.
Is the num2str() part intended to mean that the field name you want to update will not be SSID but will instead be SSID followed by a number that happens to be the RSSI ? So if the RSSI were -32 you would want to update field SSID32 ??
Answers (1)
Walter Roberson
on 18 Feb 2019
If you have an SSID and you want to find out where in a list of SSIDs that the given one occurs, then you can
[wasfound, idx] = ismember(TheSSIDToTest, CellArrayOfSSIDs);
if ~wasfound
%it was not on the list, you have not heard of this one before. You might need to create a new entry
else
%TheSSIDToTest matches CellArrayOfSSIDs{idx}
RRSID_table(idx) = Updated_RRSID_information_would_be_here;
end
0 Comments
See Also
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!