I have
load t1.txt;
load t2.txt;
load t3.txt;
load t4.txt;
data=t1;
vector =[ 2 , 3 , 4 , 5 , 6 ];
for i = vector
    [TempFlag, MemberInd] = ismember( i, vector );
    fprintf('vector(%d) is %d\n', MemberInd, i);
    scatter( data(:,1),data(:,2))
end
if I want to do the above loop with all 4 files, How would you load them in a vector or something, so with each iteration it does other data?.
So I want to avoid:
data = t2;
(loop)
data = t3;
(loop)
etc.开发者_StackOverflow社区..
You've set data=1, yet used it like a matrix in this line :scatter( data(:,1),data(:,2))... that should've given you a Index exceeds matrix dimensions error.
Assuming that was a typo, and that you just want to do it for different values of data, use nested loops.
data=[1,2,3,4];
vector=[2,3,4,5,6];
for i=data
    for j=vector
        <do stuff here>
    end
end
EDIT
If your files are named t-{a,e,i,o,u} and the data variables are named the same, then you can try the following:
fileName={'ta','te','ti','to','tu'};
for i=1:length(fileName)
    dummy=load(sprintf('%s.txt',fileName{i}));
    eval(sprintf('data=dummy.%s',fileName{i}));
    <other stuff here>
end
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论