Hello all,
I'm getting the following error message when using fprintf to print a concatenated string to the console output:
Error using fprintf
Invalid file identifier. Use fopen to generate a valid file identifier.
Error in print_Test2_Stats (line 11)
s2 = "TOTAL FRAMES SENT = " + Total_Frames_t2_64Mb + "\n"; fprintf(s2);
Here is the extract from my code:
fprintf('\n'); fprintf('======================= Test 2 Round Robin Summary ======================\n'); fprintf('BOND TYPE = HOMOGENEOUS 11ac\n'); fprintf('TEST TYPE = LHS (n = 1)\n'); fprintf('SCHEDULING = ROUND ROBIN\n'); fprintf('SELECTION = STATIC\n'); fprintf('HOLD VALUE = N/A\n'); s1 = "TOTAL TIME TAKEN (us) = " + Total_Time_t2_64Mb + "\n"; fprintf(s1); s2 = "TOTAL FRAMES SENT = " + Total_Frames_t2_64Mb + "\n"; fprintf(s2); s3 = "TOTAL BITS SENT = " + Total_Bits_t2_64Mb + "\n"; fprintf(s3); s4 = "TOTAL BYTES SENT = " + Total_Bytes_t2_64Mb + "\n"; fprintf(s4); s5 = "TOTAL KILOBYTES SENT = " + Total_KBytes_t2_64Mb + "\n"; fprintf(s5); s6 = "TOTAL MEGABYTES SENT = " + Total_MBytes_t2_64Mb + "\n"; fprintf(s6); s7 = "MEAN CHAN THROUGHPUT = " + Ch_Bond_Tput_Mean_t2_64Mb + "\n"; fprintf(s7);
I have another similar function called print_Test1_Stats with exactly the same code and this is working fine:
fprintf('\n'); fprintf('======================= Test 1 Round Robin Summary ======================\n'); fprintf('BOND TYPE = HETEROGENEOUS 11ac-11ah\n'); fprintf('TEST TYPE = BALANCED\n'); fprintf('SCHEDULING = ROUND ROBIN\n'); fprintf('SELECTION = STATIC\n'); fprintf('HOLD VALUE = N/A\n'); s1 = "TOTAL TIME TAKEN (us) = " + Total_Time_t1_64Mb + "\n"; fprintf(s1); s2 = "TOTAL FRAMES SENT = " + Total_Frames_t1_64Mb + "\n"; fprintf(s2); s3 = "TOTAL BITS SENT = " + Total_Bits_t1_64Mb + "\n"; fprintf(s3); s4 = "TOTAL BYTES SENT = " + Total_Bytes_t1_64Mb + "\n"; fprintf(s4); s5 = "TOTAL KILOBYTES SENT = " + Total_KBytes_t1_64Mb + "\n"; fprintf(s5); s6 = "TOTAL MEGABYTES SENT = " + Total_MBytes_t1_64Mb + "\n"; fprintf(s6); s7 = "MEAN CHAN THROUGHPUT = " + Ch_Bond_Tput_Mean_t1_64Mb + "\n"; fprintf(s7);
This error started appearing out of the blue and has worked fine before. Could this be a bug or is it a programming fault?
Best Answer