ahmad_abdulghany
Advanced Member level 4
- Joined
- Apr 12, 2005
- Messages
- 1,206
- Helped
- 102
- Reputation
- 206
- Reaction score
- 22
- Trophy points
- 1,318
- Location
- San Jose, California, USA
- Activity points
- 11,769
matlab read text file
Assalamo alaykom
i want anyone help me to read and write to a text file with matlab ..
what i know about this .. ( i don't know anyother thing .. i need to know every other things about this )
to write to text file :
****************
fid=fopen('file_name.txt','w' ); % i want to know other operands like 'w'
fprintf(fid,'text to be written formatted'); % i want to know if there are other options to do
fclose=(fid);
to read from text file :
******************
Sorry .. i don't know how to do this .. and know how to do ..
as an application to learn me that ..
assmume that i have a text file that contains binary data in separate lines ..each line contains one word of 42 bits ... this word is written after a lable in its line, and i have 10 lines ..
like that ..
__________________________________________________________________
label1='010001010100101001010010010011111101011010'
label2='110110101011111101000001111110101010010111'
............
__________________________________________________________________
and so on ..
now .. how can i read data from such file .. and store the bits beside each label in separate variables .. each variable should be a vector containing all bits of line as elements .. i.e. each variable is a 42 element vector..
like that : var1 =[0 1 0 0 0 1 0 1 0 1 0 0 1 0 1 0 0 1 0 1 0 0 1 0 0 1 0 0 1 1 1 1 1 1 0 1 0 1 1 0 1 0]
i hope you can understand me ... also can help me ..
Assalamo alaykom
i want anyone help me to read and write to a text file with matlab ..
what i know about this .. ( i don't know anyother thing .. i need to know every other things about this )
to write to text file :
****************
fid=fopen('file_name.txt','w' ); % i want to know other operands like 'w'
fprintf(fid,'text to be written formatted'); % i want to know if there are other options to do
fclose=(fid);
to read from text file :
******************
Sorry .. i don't know how to do this .. and know how to do ..
as an application to learn me that ..
assmume that i have a text file that contains binary data in separate lines ..each line contains one word of 42 bits ... this word is written after a lable in its line, and i have 10 lines ..
like that ..
__________________________________________________________________
label1='010001010100101001010010010011111101011010'
label2='110110101011111101000001111110101010010111'
............
__________________________________________________________________
and so on ..
now .. how can i read data from such file .. and store the bits beside each label in separate variables .. each variable should be a vector containing all bits of line as elements .. i.e. each variable is a 42 element vector..
like that : var1 =[0 1 0 0 0 1 0 1 0 1 0 0 1 0 1 0 0 1 0 1 0 0 1 0 0 1 0 0 1 1 1 1 1 1 0 1 0 1 1 0 1 0]
i hope you can understand me ... also can help me ..