From: McLaren on 21 Apr 2010 12:49 Hello, I am running cycles of data that run into the 100000s and will soon get to 10^6, and I would like to plot the hysteresis loops for the loops 1,10,100,1000,10000,99996, for whivh I have to use the indices index1, index10, index1000, index100000 and index99996; there are 29 data points in each loop hence plotting from index X to index X + 29. for i=0:5 if i < 5 eval('plot(depMTSc(index' num2str(10^i) '):index(' num2str(10^i+29) '),FMTSc(index' num2str(10^i) ':index' num2str(10^i+29) ')'); end if i==5 plot(depMTSc(index99996:index99996+29),FMTSc(index99996:index99996+29)) end end ideas?
From: Rune Allnor on 21 Apr 2010 12:54 On 21 apr, 18:49, "McLaren " <mclaren_a...(a)hotmail.com> wrote: > Hello, > > I am running cycles of data that run into the 100000s and will soon get to 10^6, and I would like to plot the hysteresis loops for the loops 1,10,100,1000,10000,99996, for whivh I have to use the indices index1, index10, index1000, index100000 and index99996; there are 29 data points in each loop hence plotting from index X to index X + 29. > > for i=0:5 > if i < 5 > eval('plot(depMTSc(index' num2str(10^i) '):index(' num2str(10^i+29) '),FMTSc(index' num2str(10^i) ':index' num2str(10^i+29) ')'); > end > if i==5 > plot(depMTSc(index99996:index99996+29),FMTSc(index99996:index99996+29)) > end > end > > ideas? Instead of encoding the ranges in variable names, use a table of indexes. The general idea goes like indexvec = [1,30,60]; for n = 1:3 plot(x(indexvec(n):indexvec(n+1)-1)); end Rune
From: us on 21 Apr 2010 13:35 "McLaren " <mclaren_alex(a)hotmail.com> wrote in message <hqnaa1$4d4$1(a)fred.mathworks.com>... > Hello, > > I am running cycles of data that run into the 100000s and will soon get to 10^6, and I would like to plot the hysteresis loops for the loops 1,10,100,1000,10000,99996, for whivh I have to use the indices index1, index10, index1000, index100000 and index99996; there are 29 data points in each loop hence plotting from index X to index X + 29. > > for i=0:5 > if i < 5 > eval('plot(depMTSc(index' num2str(10^i) '):index(' num2str(10^i+29) '),FMTSc(index' num2str(10^i) ':index' num2str(10^i+29) ')'); > end > if i==5 > plot(depMTSc(index99996:index99996+29),FMTSc(index99996:index99996+29)) > end > end > > ideas? yes... first of all: http://matlabwiki.mathworks.com/MATLAB_FAQ#How_can_I_create_variables_A1.2C_A2.2C....2CA10_in_a_loop.3F now... % the data clear ix*; % save old stuff(!)... ix100=-100; ix1=1; ix2=-2; ix3=3; ix10=-10; ix11=-11; ix12=12; ix8=8; % the engine % - do this once % get indices of sorted names... save(fnam,'ix*'); s=load(fnam); % the tedious part... fn=fieldnames(s); fn=regexp(fn,'\d+','match'); fn=[fn{:}]; fn=cellfun(@(x) sscanf(x,'%d'),fn); [fx,fx]=sort(fn); s=struct2cell(s); s=cat(1,s{:}); s=s(fx); % the result % - an easily index-able vec... disp(s); %{ 1 % <- ix1 -2 % <- ix2 3 % <- ... 8 -10 -11 12 -100 %} us
|
Pages: 1 Prev: icc profile reading error Next: simulink 7,1 vector to uint8 scalar |