How to run this loop and make sure the information from a struct is assigned as a simple m x n x k ? My loop is overwriting the information

1 view (last 30 days)
I am trying to have the N vector as an m x n x k extracting the information from a struct suite
but the loop here is being overwritten. How can I avoid the overwriting in this loop?
if isempty(locations) || nargin==2
locations = find([Suite(:).active]); %active locations [1 2 4 6]
for loc = 1:13
if Suite(loc).active
for i=locations
M=zeros(size(Suite(i).scani,1), size(Suite(i).scani,2), length(find([Suite(i).active])));
juan sanchez
juan sanchez on 11 Dec 2021
I have information stored in a suite where each location is able to store velocity in (rows indicating time, columns indicating heights). The only active locations are 1 2 4 and 6. However I want to extract that information from the suite so that I have it as a normal matlab matrix Velocity(rows,columns, pages) so that each page takes the location.
The length of location will give me the right order 1 2 3 4 as I wish the pages to be stored but the suite has the information in locations 1 2 4 and 6. I tried to do a double loop but the information is all being overwritten. Then the size of the first 2 locations has 15600 rows but the last two rows have a size of 20800 so preallocating is also an issue.

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!