accessIntervals Function: Subscripting into a Table Using One Subscript Error
14 ビュー (過去 30 日間)
古いコメントを表示
Problem Description:
I am working on a MATLAB project involving the Satellite Communications Toolbox. My script uses the accessIntervals function to compute access intervals for satellites and ground stations. However, I consistently encounter the following error:
sql
Copy code
Subscripting into a table using one subscript (as in t(i)) is not supported. Specify a row subscript and a variable subscript, as in t(rows,vars). To select variables, use t(:,i) or for one variable t.(i). To select rows, use t(i,:).
Steps to Reproduce:
- I created a satellite scenario with the following setup:matlabCopy
codestartTime = datetime(2024, 1, 6, 23, 23, 0);
stopTime = startTime + hours(24);
sampleTime = 60;
sc = satelliteScenario(startTime, stopTime, sampleTime);
sat = walkerDelta(sc, 570e3 + 6378.14e3, 70, 720, 36, 1, ArgumentOfLatitude=15, Name="Starlink");
gs = groundStation(sc, "Name", "Test Station", "Latitude", -35.40139, "Longitude", 148.98167);
ac = access(sat, gs);
- I attempted to call accessIntervals for the Access object:matlabCopy code
Test = accessIntervals(ac(1));
- The error occurs for all Access objects (ac).
Debugging Steps Taken:
- I confirmed the Access objects (ac) are valid and properly initialized:matlabCopy codeAccess Object 1:
Access with properties:
Sequence: [1 721]
LineWidth: 3
LineColor: [0.3922 0.8314 0.0745]
- The error persists for all Access objects.
Questions:
- Is this a known issue with accessIntervals or the Satellite Communications Toolbox?
- How can I resolve or work around this error to compute access intervals?
- Are there alternative methods to compute satellite-ground station access intervals if accessIntervals cannot be used?
Environment: Matlabonline
0 件のコメント
回答 (1 件)
Altaïr
2025 年 1 月 8 日
編集済み: Altaïr
2025 年 1 月 8 日
The following code executed in MATLAB Online without any errors:
startTime = datetime(2024, 1, 6, 23, 23, 0);
stopTime = startTime + hours(24);
sampleTime = 60;
sc = satelliteScenario(startTime, stopTime, sampleTime);
sat = walkerDelta(sc, 570e3 + 6378.14e3, 70, 720, 36, 1, ArgumentOfLatitude=15, Name="Starlink");
gs = groundStation(sc, "Name", "Test Station", "Latitude", -35.40139, "Longitude", 148.98167);
ac = access(sat, gs);
Test = accessIntervals(ac(1))
The error Subscripting into a table using one subscript (as in t(i)) is not supported, typically occurs when a table object isn't indexed correctly. The following MATLAB Answer is an example:
The access function returns a matlabshared.satellitescenario.Access object, not a table. However, the accessIntervals function returns a table object, and indexing it with a single subscript, as shown below, may lead to the error.
Test(1)
For more details on the output types of the access and accessIntervals functions, please refer to these documentation pages:
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Scenario Generation and Visualization についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!