From: ben harper on 3 Mar 2010 01:37 i have an easy problem. i want to load a "mat" or "txt" file. i use normally "load test_no1.mat" command can i break file name into pieces like: file1=''test_no" file2=2 file3=".mat" with changing file2 variable, i can i load other mat files. how can i do this? thank you.
From: James Tursa on 3 Mar 2010 02:20 "ben harper" <controlusc(a)gmail.com> wrote in message <hml02e$11l$1(a)fred.mathworks.com>... > i have an easy problem. > > i want to load a "mat" or "txt" file. > i use normally > "load test_no1.mat" command > > can i break file name into pieces like: > file1=''test_no" > file2=2 > file3=".mat" > > with changing file2 variable, i can i load other mat files. > how can i do this? > thank you. filename = [file1 num2str(file2) file3]; load(filename) James Tursa
From: us on 3 Mar 2010 03:20 "ben harper" <controlusc(a)gmail.com> wrote in message <hml02e$11l$1(a)fred.mathworks.com>... > i have an easy problem. > > i want to load a "mat" or "txt" file. > i use normally > "load test_no1.mat" command > > can i break file name into pieces like: > file1=''test_no" > file2=2 > file3=".mat" > > with changing file2 variable, i can i load other mat files. > how can i do this? > thank you. one of the many solutions - SPRINTF is very versatile as it allows you to add other/recurring patterns... fnma=sprintf('%s%-1d%s',file1,file2,file3); load(fnam); us
|
Pages: 1 Prev: Joint Initial Condition Actuator Next: invisible toolbar in simulink models |