xx=fsolve(@test,pi/4);// storing output in a variable 
file_id = fopen('output inlab task 01.txt', 'w+');//getting write file id
fprintf(file_id, "%f",xx);//writing to the file
fclose(file_id);//closing file id