how to create .Mat file from scratch
Show older comments
Hi
Could you please assist on the process to create a .mat file on Matlab for version R2022a, thanks
14 Comments
John D'Errico
on 28 Dec 2022
Edited: John D'Errico
on 28 Dec 2022
Is your question how to write a .mat file using a tool like save? If so, then just read the help for save, or read the examples shown.
If your question is how could you write a .mat file as a binary file where you open the file then dump stuff into the file as a binary stream, then no, we can't help you.
Your wording, "From scratch" would imply you want to learn how to write the .mat file, without using a tool like save. But it is not at all clear.
Stephen23
on 28 Dec 2022
MAT file format versions 4 and 5 are described in detail here:
Ajay
on 29 Dec 2022
Image Analyst
on 29 Dec 2022
Edited: Image Analyst
on 29 Dec 2022
@Ajay when did you last see it? Who gave it to you or where did you get it from? Or did you make it yourself and "lost" it? Did you check your recycle bin?
Ajay
on 29 Dec 2022
Walter Roberson
on 3 Jan 2023
In a situation such as this, the first thing I would do would be to try to define what it is that the slider is intended to control.
You would not use a slider to control the rules of a Fuzzy Inference Engine. You might use a slider to control a constant signal, or to control a parameter such as the magnitude of a Gain block -- but your model does not have anything like those.
Ajay
on 4 Jan 2023
Walter Roberson
on 4 Jan 2023
Since the sliders described above control parameters or variables, you could (if needed) have them control the value of a Constant block that was being fed into the Temperature or whatever block as the input signal.
Ajay
on 5 Jan 2023
Walter Roberson
on 5 Jan 2023
If I recall correctly triangles with -K- are Gain blocks not constant blocks. And you have no signal feeding the Gain blocks so probably you are magnifying zeros, getting zeros.
Ajay
on 5 Jan 2023
Walter Roberson
on 5 Jan 2023
I have attached an example.
The second computation in the example, producing "WC", has no basis in any physics; I just needed to put in something to show that the code worked.
To use: carefully click on the red bar of one of the two sliders and drag it. When you have both positioned as desired, click Run and observe the (useless) answer.
You might be able to use the same kind of slider style that you used in your code; the important part of the example is that the sliders are adjusting the parameters of constant blocks and the blocks are then acting as input signals.
Accepted Answer
More Answers (1)
Atsushi Ueno
on 28 Dec 2022
Moved: Image Analyst
on 29 Dec 2022
a = 123; b = 456.789;
whos % variables a and b are displayed
save test.mat
clear all
whos % nothing is displayed
load test.mat
whos % variables a and b are displayed again
Categories
Find more on Fuzzy Logic in Simulink in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!