Hi guys!
I have run into problems when I try to make a loop create variables and I am not very advanced in matlab. Here is what I am trying to do:
I have a .csv-file containing columns with data, each called test1, test2 and so forth. For each column, I am trying to create a variable in matlab – something like:
for i = 1:10 test(i) = csvvariable(:,i)end
What I have done so far is manually creating a variable for each column in the .csv-file:
rfdtest = csvread('Hamstring.csv', 8, 1);test1 = rfdtest(:,1); if test1(1)>0 test1=[0;test1] endtest2 = rfdtest(:,2); if test2(1)>0 test2=[0;test2] endtest3 = rfdtest(:,3); if test3(1)>0 test3=[0;test3] endtest4 = rfdtest(:,4); if test4(1)>0 test4=[0;test4] endtest5 = rfdtest(:,5); if test5(1)>0 test5=[0;test5] endtest6 = rfdtest(:,6); if test6(1)>0 test6=[0;test6] endtest7 = rfdtest(:,7); if test7(1)>0 test7=[0;test7] endtest8 = rfdtest(:,8); if test8(1)>0 test8=[0;test8] endtest9 = rfdtest(:,9); if test9(1)>0 test9=[0;test9] endtest10 = rfdtest(:,10); if test10(1)>0 test10=[0;test10] end
Later, I am going to do some calculations on each column, so this method will result in a lot of code.
Thanks in advance and feel free to ask for additional details!
Best Answer