how to create .Mat file from scratch
이전 댓글 표시
Hi
Could you please assist on the process to create a .mat file on Matlab for version R2022a, thanks
댓글 수: 14
John D'Errico
2022년 12월 28일
편집: John D'Errico
2022년 12월 28일
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
2022년 12월 28일
MAT file format versions 4 and 5 are described in detail here:
Ajay
2022년 12월 29일
Image Analyst
2022년 12월 29일
편집: Image Analyst
2022년 12월 29일
@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
2022년 12월 29일
Walter Roberson
2023년 1월 3일
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
2023년 1월 4일
Walter Roberson
2023년 1월 4일
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
2023년 1월 5일
Walter Roberson
2023년 1월 5일
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
2023년 1월 5일
Walter Roberson
2023년 1월 5일
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.
채택된 답변
추가 답변 (1개)
Atsushi Ueno
2022년 12월 28일
이동: Image Analyst
2022년 12월 29일
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
카테고리
도움말 센터 및 File Exchange에서 Fuzzy Logic in Simulink에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!