Processing three-dimensional array
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello
This question is basically the extension of
dpb provided the solution for two-dimensional array and the code is working just fine. It just needs some modifications to be applied for the new requirements.
Now I have a three-dimensional array 288x55x11. Each column represents the voltages, the rows represent a load and the third subscript represents different penetration levels (ranging from 0% to 100% in steps of 10% which makes the total number of levels amounts to 11).
The code should do the same as in the solution provided by dpb (please refer to the link ), BUT now it should process three-dimensional array to identify the loads which are not within the range and calculate the total number of loads which are not within the range.
Also, it needs to build the matrix nxm where n - %penetration and m - number of loads not within the limits
Basically, the output of the script is expected to look like, for example:
At 0% penetration: Loads not within the range: All is okay. Total number of loads: 0
At 10% penetration: Loads not within the range: Load 4, 7, 9. Total number of loads: 3
At 20% penetration: Loads not within the range: Load 4, 7, 9, 15, 20, 21, 25. Total number of loads: 7
.
.
.
At 100% penetration: Loads not within the range: Load 4, 7, 9, 15, 20, 21, 25, 30, 31, 35, 37, 39, 40, 41, 42, 46. Total number of loads: 16
Once again, 0%, 10%, ..., 100% represent the third subscript of the three-dimensional array, which is of size 288x55x11.
Any help is greatly appreciated.
Thank you.
3 Commenti
dpb
il 5 Mar 2017
Modificato: dpb
il 6 Mar 2017
"Subscript indices must ... be real positive integers..."
The Matlab error message could be more specific; I've noted this to TMW on many occasions but array indices in Matlab are constrained to start at lower bound of 1, not 0. TMW in the error message considers the mathematical definition of 0 as nonpositive but I'd wager most novice users don't think of it just as it wasn't immediately obvious to you; I don't see why the message couldn't say that specifically; you've already error'ed and crashed, the overhead of a little additional processing it presenting the error message specific for a zero array index couldn't possibly be excessive it would seem.
for i=0:11
ix=iswithin(loads(:,:,i),lo,hi);
The first loop value here is out of range; the 11 planes in the array are number 1:11 while there are 12 elements in the 0:11 vector beginning at 0.
Risposte (0)
Vedere anche
Categorie
Scopri di più su Matrix Indexing in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!