Question
I want to find the mean of all rows in the data set . But the data in the workspace is in the following formate. let A be data set. A=<54×10 struct> where each row of A is in the following format <1x1 struct> <1x1 struct> <1x1 struct> <1x1 struct> <1x1 struct> <1x1 struct> <1x1 struct> <1x1 struct> <1x1 struct> <1x1 struct> How can I find the mean of each row of A.
Expert Answer
Neeta Dsouza
PhD Expert
Answered Nov 20, 2025
If you use the normal dot indexing with a struct array, that will generate a comma separated list.
You can put that between brackets to concatenate the resulting values, but you will need to use reshape to restore the original shape:
fn=websave('DATA.mat','https://www.mathworks.com/matlabcentral/answers/uploaded_files/742259/DATA.mat');
S=load(fn);npcr=S.npcr
npcr = 54×10 struct array with fields:
npcr_score
.
.
.
reshape([npcr.npcr_score],size(npcr))
ans = 54×10
0.9959 0.9965 0.9963 0.9966 0.9959 0.9964 0.9963 0.9963 0.9958 0.9963
0.9960 0.9962 0.9962 0.9960 0.9966 0.9960 0.9962 0.9960 0.9962 0.9962
0.9959 0.9965 0.9963 0.9966 0.9959 0.9964 0.9963 0.9963 0.9958 0.9963
0.9960 0.9965 0.9960 0.9959 0.9966 0.9957 0.9960 0.9963 0.9960 0.9965
0.9961 0.9964 0.9961 0.9960 0.9962 0.9958 0.9961 0.9960 0.9963 0.9962
0.9961 0.9964 0.9961 0.9960 0.9962 0.9958 0.9961 0.9960 0.9963 0.9962
0.9959 0.9959 0.9958 0.9962 0.9960 0.9962 0.9958 0.9960 0.9958 0.9956
0.9960 0.9962 0.9962 0.9960 0.9966 0.9960 0.9962 0.9960 0.9962 0.9962
0.9959 0.9965 0.9963 0.9966 0.9959 0.9964 0.9963 0.9963 0.9958 0.9963
0.9960 0.9962 0.9961 0.9960 0.9963 0.9963 0.9961 0.9961 0.9962 0.9962
100% Run Guarantee
3-Hour Fast-Track Delivery
Need a Custom Version or Complete Simulation for This Problem?
Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.
Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here
Related mean Questions & Solutions
Browse All →
Explore similar technical troubleshooting questions and verified MATLAB solutions:
Ready-to-Run MATLAB & Simulink Projects
Browse All Projects →