An array of variable-length arrays of integer numbers in matlab

You can post your problem related to MATLAB Projects here. We will try our best to help you out.
Armistead
Posts:12
Joined:Sat Feb 18, 2017 5:57 am
An array of variable-length arrays of integer numbers in matlab

Post by Armistead » Mon Mar 06, 2017 12:14 pm

I want to create an array of variable-length arrays of integer numbers in matlab. In fact i want to create a set of paths and I want to have the index of min path in the end of it. I tried to solve it with cell in matlab but i can't solve it in a good way. Can someone propose a better solution?

My solution:

Code: Select all

total=numel(Graph(:,1));
path=zeros(1,total);
paths=cell(total);
for i=1:total
        for j=1:total                
            if(path(index)==Graph(j,2))
                if(ismember(Graph(j,1),S)==true)
                    index=index+1;
                    path(index)=Graph(j,1);
                    count=count+1;
                end
            end
            lengths(jj)=count;

        end
        for kk=1:numel(path)
            paths(i,kk)={path(kk)};
        end          
end

Post Reply