Matlab loading file problem

Please support our Legacy and Other Languages advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jun 2006
Posts: 9
Reputation: jubleebow is an unknown quantity at this point 
Solved Threads: 0
jubleebow jubleebow is offline Offline
Newbie Poster

Matlab loading file problem

 
0
  #1
Jul 28th, 2006
Hi to all,
I want to ask how can I load files with for loop?
My file names are like D1,D2,D3 and so on..

THen how do i assign the filename variable so that Matlab recognises it?

I tried using this code but it seemed that Matlab recognised the a as the teh word "D1" rather than the file D1 and it says ndex exceeds matrix dimensions

for n=1:20
% read data file
load (['C:\weatherdata\D',num2str(n),'.txt']);
a = ['D',num2str(n)]

lati = a(5,: );

Thanks
Last edited by jubleebow; Jul 28th, 2006 at 7:31 am.
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 3,114
Reputation: WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of 
Solved Threads: 281
Moderator
WaltP's Avatar
WaltP WaltP is offline Offline
Posting Sensei

Re: Matlab loading file problem

 
0
  #2
Aug 4th, 2006
Create the filename as a string value and use the string instead to open the file.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Legacy and Other Languages Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC