Is there a way to return a decimal matrix to a stl file?

I changed the binary stl file made up of triangulation into decimal matrix through the fread.
I'd like to know how to revert this decimal matrix to a stl file.
And the decimal matrix consists of 13797684x1 double, and the stl file is the binary file.

 Accepted Answer

8 Comments

I've already tried and tried again, but I can't. One column of decimal numbers did not revert to triangulation.
Could you explain that in more detail?
I would expect a binary stl file to have lists of coordinates and lists of faces. I would not expect fread to be enough to recover the structure of the file, and would expect that you would use stlread to access the content instead of fread
Well, here's a new link that I asked in more detail.
And I want to list the string file biennially, change it to a string, apply rs code, and change it back to stl file.
Sorry, I do not know what you mean by "string file" ? I also do not understand "biennially" in this context, and I do not know what "rs code" means here ?
I'm sorry, but the meaning seems to have not been conveyed because I used a part of the translator.
string means text, biennially means binary, ans rs code means Reed Solomon code.
k = 7;
n = 2*k+1; %or as appropriate. It must be > k and if k is odd then n must be odd
fid = fopen('Mesh_04.stl', 'r');
as_binary = fread(fid);
fclose(fid);
as_text = char(as_binary.');
as_text_rows = buffer(as_text, k).';
as_gf_rows = gf( double(as_text_rows), 8 );
enc_msg_rows = rsenc(as_gf_rows, n, k );
enc_binary_stream = reshape(enc_msg_rows.x .', [], 1);
fid = fopen('newfile.bin', 'w'); %NOT .stl -- it is not an stl file!
fwrite(fid, 'uint8');
fclose(fid);
However it would be easier if you did not convert it to text.
It is not appropriate to write the result of the RS encoding into a file with .stl file extension, as it is not a valid .stl file.
Oh...I wanted to somehow get the binary file back to stl... Is there no way?
In order to convert the binary file back to stl you would need to read the binary file and do a Reed Solomon decoding on it to strip out the extra information.
The only reason to go through a Reed Solomon step is if the encoded binary is going to be transmitted over a channel that has noisy on it, as the RS information would give an opportunity to correct the noise and receive the file correctly. You might do this if you were transmitting the data by radio, and if for some reason it was cheaper to correct the data along the way instead of breaking it into sections and retransmitting the failed blocks. For example it might be worth doing if you were transmitting the file to Mars. Or if you were transmitting by satellite, as download bandwidth for satellite is much higher than upload bandwidth except at base stations.

Sign in to comment.

More Answers (0)

Products

Release

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!