How to create excel sheet for developed model using MATLAB
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have subsystem which is having few input/output. I want to do testing using excel sheet.
How to create excel using script which generate input and output inside excel.
or any other way to test the model.
Please let me know the solution
2 commentaires
Réponses (1)
Shaunak
le 16 Mai 2025
Modifié(e) : Shaunak
le 16 Mai 2025
Hi Maya,
It is my understanding that you want to generate an Excel sheet containing both input and output data for your Simulink system to facilitate testing. You can use MATLAB’s built-in functions to programmatically create and write data to an Excel file. This approach lets you automate the process and ensures your test data is well organized for later analysis.
Here is an example of how you can generate some sample input data, simulate the model to get outputs, and write both to an Excel sheet:
% Example: Generate test input data
N = 100; % Number of test cases
input1 = randn(N,1); % Example input 1
input2 = rand(N,1); % Example input 2
% Combine inputs into a table
inputTable = table(input1, input2);
% (Optional) Simulate your model here to get outputs
% For demonstration, let's create some dummy outputs
output1 = 2*input1 + 3*input2; % Replace with your model's output
output2 = input1 - input2; % Replace with your model's output
% Combine inputs and outputs into one table
testData = table(input1, input2, output1, output2);
% Write the table to an Excel file
writetable(testData, 'model_test_data.xlsx');
% Now, 'model_test_data.xlsx' contains both input and output data
You can use this Excel file for further testing or as a test harness for your Simulink model.
For more details on writing data to Excel in MATLAB, you can refer to the following documentation:
Hope this helps!
0 commentaires
Voir également
Catégories
En savoir plus sur Data Import from MATLAB dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!