I want to write the array cloud which is nothing abut a array storing the coordinates of a circular cloud with two columns, of latitude and longitude. I want these coordinates to be written on a text file in a manner like this.
418.9517 43.9866
419.2260 44.1501
419.4826 44.3402
419.7190 44.5550
419.9327 44.7923
420.1217 45.0497
With this code i want to generate multiple no of such files storing the coordinates of a single cloud in one file.
Here a is array with first two columns of latitude and longitude (center of circle) and the third one radius of the circle. And z =size(a).(which is 2905×3). So that makes a total of 2905 files to be written.
for s =1:z(1)
r= a(s,3);
ang=0:0.1:2*pi;
xp=a(s,1) + r*cos(ang);
yp=a(s,2) + r*sin(ang);
xp=xp';
yp= yp';
cloud = [xp,yp]
filename = ['Shower_Cloud',s,'number.txt']
file_id = fopen (filename,'w');
fprintf(file_id,'%g\t',cloud[]);
fclose(file_id);
end
The error when i run the code is the main problem i’m not able to diagnose this problem on my own, although i have a feeling its a minor one.
>> xyz
D:\Users\Vikram\Documents\MATLAB\Manuela\Version_2\Weather\Shower\xyz.m:
Too many files open; check that FILES = 20 in
your CONFIG.SYS file.
Unexpected error status flag encountered. Resetting to proper state.
Please ask if i missed on something important to mention.
This is just a guess but one could expect strange behavior when concatenating numbers with strings.
You may want to use
num2str(s)in creating the file name.