- The siteviewer object’s Buildings property is read-only (see documentation).
- There are no public methods to update or clear buildings in an existing siteviewer.
- The typical workflow (as in your code) is to create a new siteviewer for each environmental change, run your simulation, then close it.
How to update the 'Buildings' parameter in 'siteviewer' without recreate a new 'siteviewer'?
20 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I get the raytrace results for multiple users under the varying environment. I could vary the propery (riverTbl.MinHeight in the following code) that I want to vary, but the 'raytrace' need the 'Map' input is a 'viewer', and 'viewer.Buildings' proporty is read-only (https://au.mathworks.com/help/antenna/ref/siteviewer.html?s_tid=srchtitle_support_results_1_siteviewer#d126e157388).
So my question is how to update the 'building' parameter in 'siteviewer' without recreate a new 'siteviewer'?
part of my code following digital twin example https://au.mathworks.com/help/5g/ug/analyze-sinr-in-6g-fr3-network-using-digital-twin.html
pm = propagationModel("raytracing",MaxNumReflections=maxNumReflections, ...
MaxNumDiffractions=maxNumDiffractions);
parfor k = 1:numel(waterLevels)
fprintf("simulated water level is %f", waterLevels(k));
rx = rxsite(Latitude=-33.821949,Longitude=151.094490,AntennaAngle=[0; 40], AntennaHeight=5);
nUEs = length(rx);
% Assign arrays to each rxsite
for n = 1:nUEs
rx(n).Antenna = phased.URA(Size=rxArraySize,ElementSpacing=0.5*lambda);
end
% 1) Make a one-row table with the same structure as buildingsTbl
riverTbl = buildingsTbl(1,:); % copy structure & variable types
% 2) Overwrite fields for the river object
riverTbl.Shape = riverShape; % horizontal water polygon
riverTbl.Name = "River"; % optional
riverTbl.Material = "water"; % use a material you define in dict
riverTbl.Color = "#89CFF0"; % any color you like
riverTbl.Type = buildingsTbl.Type(2); % just a label
% Heights: treat water as a shallow horizontal slab
riverTbl.MinHeight = waterLevels(k); % water surface height
riverTbl.MaxHeight = waterLevels(k); % same => effectively a plane
% IDs: just give some unique dummy values so they don't collide
riverTbl.BuildingID = "Parramatta River";
riverTbl.PartID = 0;
% Centroid: optional – if you need it, you can approximate by bounding box
% (Site Viewer/ray tracer does *not* require Centroid)
try
gt = table(riverShape,'VariableNames',{'Shape'});
t = geotable2table(gt,"Latitude","Longitude"); % Mapping Toolbox
latc = mean(t.Latitude,"omitnan");
lonc = mean(t.Longitude,"omitnan");
riverTbl.Centroid = geopointshape(latc,lonc);
catch
% Fallback: reuse an existing centroid, not critical for ray tracing
riverTbl.Centroid = buildingsTbl.Centroid(1);
end
riverTbl.Shape = geoclip(riverTbl.Shape, AOI);
riverTbl = riverTbl(riverTbl.Shape.NumRegions > 0, :);
% 3) Combine buildings and river into one scene table
sceneTbl = [buildingsTbl; riverTbl];
viewer = siteviewer(Buildings=sceneTbl, Terrain="none", Basemap="grayland", Hidden=true);
rays = raytrace(tx,rx,pm, Map=viewer);
carrier = pre6GCarrierConfig(NSizeGrid=NRB);
% Calculate channel matrices using SVD
H = calculateChannelMatrix(carrier,tx,rx,rays);
% Calculate precoding (digital beamforming) and combining weights for all gNB to UE links
[Wrx,S,Wtx] = pagesvd(H);
% UE received signal power (dBm)
ueSignalPowerdBm = calculateSignalPower(tx,rx,rays,Wtx,Wrx);
% UE received signal power (W)
ueSignalPowerW = dBm2W(ueSignalPowerdBm);
rxPowerByLevel{k} = ueSignalPowerdBm;
close(viewer);
end
0 comentarios
Respuestas (1)
Aditya
el 17 de Dic. de 2025 a las 5:30
Hi Evelyn,
You cannot update the buildings in a siteviewer after creation—the Buildings property is read-only and there’s no documented way to update it in-place. You must create a new siteviewer each time you change the environment.
You can minimize overhead by setting Hidden=true so the GUI does not render.
Ver también
Categorías
Más información sobre RF Propagation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!