comparing and updating fields in a structure

2 ビュー (過去 30 日間)
Hamda Altamimi
Hamda Altamimi 2019 年 2 月 18 日
回答済み: Walter Roberson 2019 年 2 月 18 日
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 件のコメント
Walter Roberson
Walter Roberson 2019 年 2 月 18 日
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 ??
Hamda Altamimi
Hamda Altamimi 2019 年 2 月 18 日
to make it clear:
I will be reciving an SSID and its RSSI value
and I have a table of SSID (certain number of devices) , so the SSID will recieve many devices I want it to start comparing the original table if the SSID which is save in (wifiScanDataStruct.UserData.Dev(i).SSID) and the recievd is saved in (tmp.SSID(1))
so when it will start comparing and checking if it is right so we need to update the RSSI value of ( (wifiScanDataStruct.UserData.Dev(i).RSSI)) taking the value from the corresponding (tmp.RSSI(1))
And for the (i) is to do a loop for the number of devices I have (missing part of code Dev_SSID_Table = [ "DD-WRT", "KU-AUH-STUDENTS", "KU-AUH-STAFF", "KU-AUH-GUEST", "eduroam"];)
I hope it is clear now

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

回答 (1 件)

Walter Roberson
Walter Roberson 2019 年 2 月 18 日
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

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by