comparing and updating fields in a structure
2 ビュー (過去 30 日間)
古いコメントを表示
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
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 ??
回答 (1 件)
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
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!