getAll
Class: cv.cvdatagroup
Namespace: cv
Get all
cvdata objects in cvdatagroup object
Description
returns the covDataArray = getAll(cvdg)cvdata objects in the cv.cvdatagroup
object cvdg.
returns the covDataArray = getAll(cvdg,simMode)cvdata objects that have simulation mode
simMode.
Input Arguments
Coverage data group, specified as a cvdatagroup
object.
Data Types: cv.cvdatagroup
Simulation mode that corresponds to one or more cvdata objects in the cv.cvdatagroup object, specified as one of the following:
| Object Specification | Description |
|---|---|
| Model in normal simulation mode. |
| Model in software-in-the-loop (SIL) or processor-in-the-loop (PIL) simulation mode. |
| Model reference in software-in-the-loop (SIL) or processor-in-the-loop (PIL) simulation mode. |
| Model reference in software-in-the-loop (SIL) or processor-in-the-loop (PIL) simulation mode with the code interface set to the top model. |
If the function does not find a match, it returns an empty array. If the function finds multiple matches, it returns a cell array.
Data Types: char | string
Output Arguments
Coverage data, returned as a cell array of cvdata
objects. If you specified simMode,
covDataArray contains only coverage data that
matches simMode.
Data Types: cell
Examples
This example shows how to retrieve a specified coverage data object, all coverage data objects, or all coverage data object names from a cv.cvdatagroup object.
Load the example model.
modelName = 'slvnvdemo_eml_model_coverage_demo';
load_system(modelName);
Use the Simulink.SimulationInput class to set up the simulation scenario with coverage enabled.
simIn = Simulink.SimulationInput(modelName); simIn = setModelParameter(simIn,'CovEnable','on'); simIn = setModelParameter(simIn,'CovMetricStructuralLevel','MCDC'); simIn = setModelParameter(simIn,'CovSaveSingleToWorkspaceVar','on'); simIn = setModelParameter(simIn,'CovSaveName','covData'); simIn = setModelParameter(simIn,'CovSaveOutputData','off');
Simulate the model by passing the SimulationInput object to the sim function, and then retrieve the coverage data from the SimulationOutput object.
simOut = sim(simIn); covData = simOut.covData
covData = ... cv.cvdatagroup slcoverageExternalFile (simulation mode: Normal) slvnvdemo_eml_model_coverage_demo (simulation mode: Normal)
The example model contains a MATLAB® Function block that calls an external MATLAB function. Because Simulink Coverage returns the coverage data for the MATLAB function in a separate cvdata object, sim returns a cv.cvdatagroup object that contains the coverage results for both the model and the MATLAB function.
To determine the name associated with each cvdata object inside the cv.cvdatagroup, use the class method allNames.
covDataNames = allNames(covData)
covDataNames =
2×1 cell array
{'slcoverageExternalFile' }
{'slvnvdemo_eml_model_coverage_demo'}
The cv.cvdatagroup contains the coverage results for the model as well as the MATLAB function.
To retrieve the coverage data for the model, use the get class method.
modelCovData = get(covData,modelName)
modelCovData = ... cvdata
version: (R2025b)
id: 882
type: TEST_DATA
test: cvtest object
rootID: 884
checksum: [1x1 struct]
modelinfo: [1x1 struct]
startTime: 12-Aug-2025 18:01:59
stopTime: 12-Aug-2025 18:01:59
intervalStartTime:
intervalStopTime:
simulationStartTime: 0
simulationStopTime: 1
filter:
simMode: Normal
To retrieve coverage data for both the model and the external file, use the getAll class method.
covDataArray = getAll(covData)
covDataArray =
2×1 cell array
{1×1 cvdata}
{1×1 cvdata}
Version History
Introduced in R2007b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)