
X = Īs we can see in the output, the fprintf function has written our data to the file created.
#How to write c code in matlab mod
This is how our input and output will look like in MATLAB:Īs we can see in the output, the fprintf function has the written output of the mod function.

Use ‘%d’ inside fomatspec to print each value of the array.Pass this input arrayand mod function as an argument to the fprintf function.The data to be written will be output of a mod function. In this example, we will use the fprintf function to write data to our file.

Let us now understand the code to use the above 2 functions to write to a file Example #1 fprintf(file_ID, formatSpec, X1, X2, …, Xn) will write the data to our file ‘file_ID’ by applying the formatSpec to all the elements of the input arrays X1, X2, …Xn in the column order.fprintf(formatSpec, X1, X2, …, Xn)will write the data to our file by applying the formatSpec to all the elements of the input arrays X1, X2, …Xn in the column order.Hadoop, Data Science, Statistics & othersįprintf(file_ID, formatSpec, X1, X2.
