├── .gitattributes ├── C_project ├── CS_GUI │ ├── GUI │ │ ├── .vs │ │ │ └── GUI │ │ │ │ └── v17 │ │ │ │ └── .suo │ │ ├── App.config │ │ ├── GUI.csproj │ │ ├── GUI.sln │ │ ├── Program.cs │ │ ├── Properties │ │ │ ├── AssemblyInfo.cs │ │ │ ├── Resources.Designer.cs │ │ │ ├── Resources.resx │ │ │ ├── Settings.Designer.cs │ │ │ └── Settings.settings │ │ ├── UIFigure.Designer.cs │ │ ├── UIFigure.cs │ │ ├── UIFigure.resx │ │ ├── bin │ │ │ └── x64 │ │ │ │ ├── Debug │ │ │ │ ├── GUI.exe │ │ │ │ ├── GUI.pdb │ │ │ │ ├── KnobControl.dll │ │ │ │ ├── Lamp.dll │ │ │ │ ├── LiveCharts.WinForms.dll │ │ │ │ ├── LiveCharts.WinForms.pdb │ │ │ │ ├── LiveCharts.Wpf.dll │ │ │ │ ├── LiveCharts.Wpf.pdb │ │ │ │ ├── LiveCharts.dll │ │ │ │ ├── LiveCharts.pdb │ │ │ │ └── filter_bode.dll │ │ │ │ └── Release │ │ │ │ ├── GUI.exe │ │ │ │ ├── GUI.pdb │ │ │ │ ├── KnobControl.dll │ │ │ │ ├── Lamp.dll │ │ │ │ ├── LiveCharts.WinForms.dll │ │ │ │ ├── LiveCharts.WinForms.pdb │ │ │ │ ├── LiveCharts.Wpf.dll │ │ │ │ ├── LiveCharts.Wpf.pdb │ │ │ │ ├── LiveCharts.dll │ │ │ │ ├── LiveCharts.pdb │ │ │ │ └── filter_bode.dll │ │ ├── favicon.ico │ │ ├── filter_bode.dll │ │ ├── filter_bode_ML.dll │ │ ├── filter_bode_VS.dll │ │ ├── packages.config │ │ └── packages │ │ │ ├── LiveCharts.0.9.7 │ │ │ ├── LiveCharts.0.9.7.nupkg │ │ │ ├── lib │ │ │ │ ├── net40 │ │ │ │ │ ├── LiveCharts.dll │ │ │ │ │ ├── LiveCharts.pdb │ │ │ │ │ └── LiveCharts.xml │ │ │ │ ├── net45 │ │ │ │ │ ├── LiveCharts.dll │ │ │ │ │ ├── LiveCharts.pdb │ │ │ │ │ └── LiveCharts.xml │ │ │ │ └── portable-net45+win8+wp8 │ │ │ │ │ ├── LiveCharts.XML │ │ │ │ │ ├── LiveCharts.dll │ │ │ │ │ └── LiveCharts.pdb │ │ │ └── readme.txt │ │ │ ├── LiveCharts.WinForms.0.9.7.1 │ │ │ ├── LiveCharts.WinForms.0.9.7.1.nupkg │ │ │ ├── lib │ │ │ │ ├── net40 │ │ │ │ │ ├── LiveCharts.WinForms.XML │ │ │ │ │ ├── LiveCharts.WinForms.dll │ │ │ │ │ └── LiveCharts.WinForms.pdb │ │ │ │ └── net45 │ │ │ │ │ ├── LiveCharts.WinForms.XML │ │ │ │ │ ├── LiveCharts.WinForms.dll │ │ │ │ │ └── LiveCharts.WinForms.pdb │ │ │ └── tools │ │ │ │ └── install.ps1 │ │ │ └── LiveCharts.Wpf.0.9.7 │ │ │ ├── LiveCharts.Wpf.0.9.7.nupkg │ │ │ ├── lib │ │ │ ├── net40 │ │ │ │ ├── LiveCharts.Wpf.XML │ │ │ │ ├── LiveCharts.Wpf.dll │ │ │ │ └── LiveCharts.Wpf.pdb │ │ │ └── net45 │ │ │ │ ├── LiveCharts.Wpf.XML │ │ │ │ ├── LiveCharts.Wpf.dll │ │ │ │ └── LiveCharts.Wpf.pdb │ │ │ └── tools │ │ │ └── install.ps1 │ ├── KnobControl │ │ └── bin │ │ │ ├── Debug │ │ │ └── KnobControl.dll │ │ │ └── Release │ │ │ └── KnobControl.dll │ ├── LampControl │ │ ├── Debug │ │ │ └── Lamp.dll │ │ └── Release │ │ │ └── Lamp.dll │ └── M_Algorithm │ │ ├── C_codegen.m │ │ ├── filter_bode.m │ │ └── filter_bode_DLL.m └── C_DISLIN │ ├── Dev-Cpp │ ├── Filter_Design.dev │ ├── Filter_Design.exe │ ├── Parse_files.m │ ├── main.c │ ├── main.h │ ├── main.txt │ ├── main_original.c │ ├── main_original.h │ ├── main_types.h │ ├── min_and_max.txt │ └── rtwtypes.h │ └── VS2022 │ ├── .vs │ └── Filter_Design │ │ └── v17 │ │ └── .suo │ ├── Filter_Design.sln │ ├── Filter_Design.vcxproj │ ├── Filter_Design.vcxproj.filters │ ├── Filter_Design.vcxproj.user │ ├── Parse_files.m │ ├── main.c │ ├── main.h │ ├── main.txt │ ├── main_original.c │ ├── main_original.h │ ├── min_and_max.txt │ ├── rtwtypes.h │ ├── tmwtypes.h │ └── x64 │ ├── Debug │ └── Filter_Design.exe │ └── Release │ └── Filter_Design.exe ├── M_C_project ├── check_num_input.m ├── check_str_input.m ├── check_yes_or_no.m ├── filter_bode.m ├── main.m ├── main.prj ├── plot_filter.m └── test_main.m ├── M_MEX_project ├── Deployment │ ├── FilterDesign.ctf │ ├── FilterDesign.exe │ ├── FilterDesignCompiler.prj │ ├── FilterDesignWebApp.prj │ ├── favicon.png │ └── splash_screen.png ├── Filter_Design.mlapp ├── check_num_input.m ├── check_str_input.m ├── check_yes_or_no.m ├── filter_bode.m ├── filter_bode_mex.mexw64 ├── main.m ├── main.prj ├── main_mex.mexw64 ├── plot_filter.m ├── test_filter_bode.m └── test_main.m ├── _Documents ├── Filter_Design_C_Codegen_and_Deployment.pdf └── Readme.pdf └── license.txt /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/.vs/GUI/v17/.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/.vs/GUI/v17/.suo -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/GUI.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {DF2C7B6B-E47C-42A6-9DAE-248A9EDBF562} 8 | WinExe 9 | Properties 10 | GUI 11 | GUI 12 | v4.8 13 | 512 14 | true 15 | 16 | false 17 | publish\ 18 | true 19 | Disk 20 | false 21 | Foreground 22 | 7 23 | Days 24 | false 25 | false 26 | true 27 | 0 28 | 1.0.0.%2a 29 | false 30 | true 31 | 32 | 33 | AnyCPU 34 | true 35 | full 36 | false 37 | bin\Debug\ 38 | DEBUG;TRACE 39 | prompt 40 | 4 41 | false 42 | 43 | 44 | AnyCPU 45 | pdbonly 46 | true 47 | bin\Release\ 48 | TRACE 49 | prompt 50 | 4 51 | false 52 | 53 | 54 | true 55 | bin\x86\Debug\ 56 | DEBUG;TRACE 57 | full 58 | x86 59 | prompt 60 | MinimumRecommendedRules.ruleset 61 | true 62 | 63 | 64 | bin\x86\Release\ 65 | TRACE 66 | true 67 | pdbonly 68 | x86 69 | prompt 70 | MinimumRecommendedRules.ruleset 71 | true 72 | 73 | 74 | true 75 | bin\x64\Debug\ 76 | DEBUG;TRACE 77 | full 78 | x64 79 | prompt 80 | MinimumRecommendedRules.ruleset 81 | true 82 | 83 | 84 | bin\x64\Release\ 85 | TRACE 86 | true 87 | pdbonly 88 | x64 89 | prompt 90 | MinimumRecommendedRules.ruleset 91 | true 92 | 93 | 94 | 95 | ..\knobControl\bin\Release\KnobControl.dll 96 | 97 | 98 | ..\..\..\..\..\..\branches\Sebastien_Dupertuis\Demo_development\AppDesignerLibrary\InstrumentationLibrary\Lamp\Lamp\bin\Debug\Lamp.dll 99 | 100 | 101 | packages\LiveCharts.0.9.7\lib\net45\LiveCharts.dll 102 | True 103 | 104 | 105 | packages\LiveCharts.WinForms.0.9.7.1\lib\net45\LiveCharts.WinForms.dll 106 | True 107 | 108 | 109 | packages\LiveCharts.Wpf.0.9.7\lib\net45\LiveCharts.Wpf.dll 110 | True 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | Form 132 | 133 | 134 | UIFigure.cs 135 | 136 | 137 | 138 | 139 | UIFigure.cs 140 | Designer 141 | 142 | 143 | ResXFileCodeGenerator 144 | Resources.Designer.cs 145 | Designer 146 | 147 | 148 | True 149 | Resources.resx 150 | True 151 | 152 | 153 | 154 | SettingsSingleFileGenerator 155 | Settings.Designer.cs 156 | 157 | 158 | True 159 | Settings.settings 160 | True 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | False 169 | Microsoft .NET Framework 4.5.2 %28x86 and x64%29 170 | true 171 | 172 | 173 | False 174 | .NET Framework 3.5 SP1 175 | false 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | xcopy /y /d "$(ProjectDir)filter_bode.dll" "$(ProjectDir)$(OutDir)" 184 | 185 | 192 | -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/GUI.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GUI", "GUI.csproj", "{DF2C7B6B-E47C-42A6-9DAE-248A9EDBF562}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|x64 = Debug|x64 12 | Release|Any CPU = Release|Any CPU 13 | Release|x64 = Release|x64 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {DF2C7B6B-E47C-42A6-9DAE-248A9EDBF562}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {DF2C7B6B-E47C-42A6-9DAE-248A9EDBF562}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {DF2C7B6B-E47C-42A6-9DAE-248A9EDBF562}.Debug|x64.ActiveCfg = Debug|x64 19 | {DF2C7B6B-E47C-42A6-9DAE-248A9EDBF562}.Debug|x64.Build.0 = Debug|x64 20 | {DF2C7B6B-E47C-42A6-9DAE-248A9EDBF562}.Release|Any CPU.ActiveCfg = Release|Any CPU 21 | {DF2C7B6B-E47C-42A6-9DAE-248A9EDBF562}.Release|Any CPU.Build.0 = Release|Any CPU 22 | {DF2C7B6B-E47C-42A6-9DAE-248A9EDBF562}.Release|x64.ActiveCfg = Release|x64 23 | {DF2C7B6B-E47C-42A6-9DAE-248A9EDBF562}.Release|x64.Build.0 = Release|x64 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace GUI 8 | { 9 | static class Program 10 | { 11 | /// 12 | /// The main entry point for the application. 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new UIFigure()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("GUI")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("GUI")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("df2c7b6b-e47c-42a6-9dae-248a9edbf562")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace GUI.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("GUI.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace GUI.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.10.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/UIFigure.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.IO; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | using System.Windows.Forms; 11 | using System.Runtime.InteropServices; 12 | using LiveCharts; 13 | using LiveCharts.Wpf; 14 | using LiveCharts.Configurations; 15 | using LiveCharts.Defaults; 16 | 17 | namespace GUI 18 | { 19 | public partial class UIFigure : Form 20 | { 21 | // Import of the MATLAB algorithm as an external C DLL 22 | [DllImport("filter_bode.dll")] 23 | public static extern void filter_bode_DLL(Double[] f, Double f_0, Double q_0, Double g, string f_t, int n_f, Double[] H_mod, Double[] H_arg, ref Int32 error_flag); 24 | 25 | // Number of points in each data vectors 26 | public const Int32 NB_POINTS = 100000; // This value is fixed in the DLL, so it must be the same 27 | // 1 point to display every RATIO 28 | public const Int32 RATIO = 500; 29 | // Definition of the smallest log power to use to define the frequency vector 30 | public const Double MIN_PWR = 0; 31 | // Definition of the biggest log power to use to define the frequency vector 32 | public const Double MAX_PWR = 9; 33 | // Definition of the 2 possible errors the filter function can return 34 | public const Int32 ERROR_TYPE = 1; 35 | public const Int32 ERROR_ORDER = 2; 36 | // Definition of the maximal possible unsigned integers for color coding 37 | const int UINT8_MAX = 255; 38 | // Definition of charts constants 39 | public const Int32 FONT_SIZE = 16; 40 | public const Double PLOT_OPACITY = 0.2; 41 | public const Double PLOT_STROKE = 2.5; 42 | // Declare the filter's type property of type string 43 | public string f_t = "low"; 44 | // Declare the filter's order property of type int 45 | public int n_f = 1; 46 | // Declare the filter's cutoff frequency property of type int 47 | public Double f_0 = 1.0; 48 | // Declare the filter's quality factor property of type int 49 | public Double q_0 = 1.0; 50 | // Declare the filter's linear gain property of type int 51 | public Double g = 1.0; 52 | // Declare the frequency vector 53 | public Double[] f = new Double[NB_POINTS]; 54 | // Declare the argument vector 55 | public Double[] H_arg = new Double[NB_POINTS]; 56 | // Declare the amplitude vector 57 | public Double[] H_mod = new Double[NB_POINTS]; 58 | // Initialize the error code 59 | public Int32 error_flag = 0; 60 | // Identifier to recognize the first plot done 61 | public Boolean first_plot = true; 62 | // Declare the methods to update the values to displays in both charts 63 | public ChartValues ValuesMod { get; set; } 64 | public ChartValues ValuesArg { get; set; } 65 | 66 | public UIFigure() 67 | { 68 | InitializeComponent(); 69 | 70 | // Definition of the logarithmic frequency range 71 | logspace(MIN_PWR, MAX_PWR, f); 72 | 73 | // Instantiation of the LiveCharts to create the Module and Argument Bode plots 74 | cartesianChartMod.Series = new SeriesCollection(Mappers.Xy() 75 | .X(point => Math.Log10(point.X)) 76 | .Y(point => point.Y)) 77 | {}; 78 | cartesianChartArg.Series = new SeriesCollection(Mappers.Xy() 79 | .X(point => Math.Log10(point.X)) 80 | .Y(point => point.Y)) 81 | {}; 82 | 83 | // The values property that stores the values to display in the Bode plots 84 | ValuesMod = new ChartValues(); 85 | ValuesArg = new ChartValues(); 86 | 87 | // Configuration of the X and Y axes of the Bode plots 88 | cartesianChartMod.AxisX.Add(new LogarithmicAxis 89 | { 90 | Title = "f [Hz]", 91 | FontSize = FONT_SIZE, 92 | Labels = new[] 93 | { 94 | "10^0", "10^1", "10^2", "10^3", "10^4", "10^5", "10^6", "10^7", "10^8", "10^9" 95 | }, 96 | LabelFormatter = value => Math.Pow(10, value).ToString("N"), 97 | Base = 10, MinValue = MIN_PWR, MaxValue = MAX_PWR, 98 | Separator = new Separator 99 | { 100 | Stroke = System.Windows.Media.Brushes.LightGray 101 | } 102 | }); 103 | cartesianChartMod.AxisY.Add(new Axis 104 | { 105 | Title = "|H| [dB]", 106 | FontSize = FONT_SIZE 107 | }); 108 | cartesianChartArg.AxisX.Add(new LogarithmicAxis 109 | { 110 | Title = "f [Hz]", 111 | FontSize = FONT_SIZE, 112 | Labels = new[] 113 | { 114 | "10^0", "10^1", "10^2", "10^3", "10^4", "10^5", "10^6", "10^7", "10^8", "10^9" 115 | }, 116 | LabelFormatter = value => Math.Pow(10, value).ToString("N"), 117 | Base = 10, MinValue = MIN_PWR, MaxValue = MAX_PWR, 118 | Separator = new Separator 119 | { 120 | Stroke = System.Windows.Media.Brushes.LightGray 121 | } 122 | }); 123 | cartesianChartArg.AxisY.Add(new Axis 124 | { 125 | Title = "arg(H) [°]", 126 | FontSize = FONT_SIZE 127 | }); 128 | } 129 | 130 | /* Function to generate a frequency vector using a logarithmic scale */ 131 | private void logspace(Double min_pwr, Double max_pwr, Double[] y) 132 | { 133 | Double[] b_y = new Double[NB_POINTS]; 134 | Double delta1; 135 | Double delta2; 136 | int k; 137 | b_y[NB_POINTS - 1] = max_pwr; 138 | b_y[0] = min_pwr; 139 | if (((min_pwr < 0.0) != (max_pwr < 0.0)) && ((Math.Abs(min_pwr) > 8.9884656743115785E+307) || 140 | (Math.Abs(max_pwr) > 8.9884656743115785E+307))) 141 | { 142 | delta1 = min_pwr / (NB_POINTS - 1); 143 | delta2 = max_pwr / (NB_POINTS - 1); 144 | for (k = 0; k < (NB_POINTS - 2); k++) 145 | { 146 | b_y[k + 1] = (min_pwr + delta2 * (1.0 + (double)k)) - delta1 * (1.0 + (double)k); 147 | } 148 | } 149 | else 150 | { 151 | delta1 = (max_pwr - min_pwr) / (NB_POINTS - 1); 152 | for (k = 0; k < (NB_POINTS - 2); k++) 153 | { 154 | b_y[k + 1] = min_pwr + (1.0 + (double)k) * delta1; 155 | } 156 | } 157 | 158 | for (k = 0; k < NB_POINTS; k++) 159 | { 160 | y[k] = Math.Pow(10.0, b_y[k]); 161 | } 162 | } 163 | 164 | /* Function to remove any extra backapaces in a string */ 165 | private static string ProcessBackspaces(string source) 166 | { 167 | char[] buffer = new char[source.Length]; 168 | int idx = 0; 169 | 170 | foreach (char c in source) 171 | { 172 | if (c != '\b') 173 | { 174 | buffer[idx] = c; 175 | idx++; 176 | } 177 | else if (idx > 0) 178 | { 179 | idx--; 180 | } 181 | } 182 | 183 | return new string(buffer, 0, idx); 184 | } 185 | 186 | private int checkInputParameters(KeyPressEventArgs e, string text, Double minBoundary, Double maxBoundary) 187 | { 188 | Double parameterValue; 189 | int result = 0; 190 | 191 | // Remove extra backspaces 192 | text = ProcessBackspaces(text); 193 | 194 | if (e.KeyChar >= '0' && e.KeyChar <= '9' || e.KeyChar == '.') 195 | { 196 | // Accept the valid input 197 | e.Handled = false; 198 | parameterValue = Double.Parse(text); 199 | if (parameterValue < minBoundary || parameterValue > maxBoundary) 200 | { 201 | // Display a warning message in the interface 202 | LogMessageValue.ForeColor = Color.Orange; 203 | LogMessageValue.Text = "Please, enter numbers that belong to this range:" + Environment.NewLine + minBoundary + " to " + maxBoundary; 204 | result = 1; 205 | } 206 | 207 | } 208 | else 209 | { 210 | // Reject the incorrect input 211 | e.Handled = true; 212 | // Display an error message in the interface 213 | LogMessageValue.ForeColor = Color.Red; 214 | LogMessageValue.Text = "Please, enter numbers [0-9 .] and no letters for the correct processing of parameters."; 215 | result = 2; 216 | } 217 | return result; 218 | } 219 | private void FilterTypeText(object sender, EventArgs e) 220 | { 221 | // Read the filter's type 222 | string filter_type = TypeDropDown.Text; 223 | 224 | // Get the type of the desired filter 225 | switch (filter_type) 226 | { 227 | case "Lowpass": 228 | f_t = "low"; 229 | break; 230 | case "Highpass": 231 | f_t = "high"; 232 | break; 233 | case "Bandpass": 234 | f_t = "band"; 235 | break; 236 | case "Stopband": 237 | f_t = "stop"; 238 | break; 239 | default: 240 | f_t = "unknown"; 241 | break; 242 | } 243 | } 244 | 245 | private void OrderKnobValue(object Sender) 246 | { 247 | // Read the filter's order 248 | n_f = OrderKnob.Value; 249 | } 250 | 251 | private void CutoffFrequencyValue_TextChanged(object sender, KeyPressEventArgs e) 252 | { 253 | // Check the data type and value range of the cutoff frequency parameter 254 | if (checkInputParameters(e, CutoffFrequencyValue.Text, 1, 1000000000) != 0) 255 | { 256 | // Reset the text field value 257 | CutoffFrequencyValue.Text = "1"; 258 | } 259 | 260 | } 261 | 262 | private void QualityFactorValue_TextChanged(object sender, KeyPressEventArgs e) 263 | { 264 | // Check the data type and value range of the quality factor parameter 265 | if (checkInputParameters(e, QualityFactorValue.Text, 0.1, 10) != 0) 266 | { 267 | // Reset the text field value 268 | QualityFactorValue.Text = "1"; 269 | } 270 | } 271 | 272 | private void LinearGainValue_TextChanged(object sender, KeyPressEventArgs e) 273 | { 274 | // Check the data type and value range of the gain parameter 275 | if (checkInputParameters(e, LinearGainValue.Text, 0.001, 1000) != 0) 276 | { 277 | // Reset the text field value 278 | LinearGainValue.Text = "1"; 279 | } 280 | } 281 | 282 | private void CreateBodesButton_Click(object sender, EventArgs e) 283 | { 284 | if (CutoffFrequencyValue.Text.Length != 0 && QualityFactorValue.Text.Length != 0 && 285 | LinearGainValue.Text.Length != 0) 286 | { 287 | // Read text field filter's parameters 288 | f_0 = Double.Parse(CutoffFrequencyValue.Text); 289 | q_0 = Double.Parse(QualityFactorValue.Text); 290 | g = Double.Parse(LinearGainValue.Text); 291 | // Will compute the filter based on the MATLAB algorithm used for C codegen 292 | filter_bode_DLL(f, f_0, q_0, g, f_t, n_f, H_mod, H_arg, ref error_flag); 293 | 294 | // If no error occured the visualization will be allowed 295 | if (error_flag == 0) 296 | { 297 | ViewBodesButton.Enabled = true; 298 | StatusLamp.ForeColor = Color.FromArgb(0, UINT8_MAX, 0); 299 | LogMessageValue.ForeColor = Color.FromArgb(0, UINT8_MAX, 0); 300 | LogMessageValue.Text = "The Bode plots have been computed successfuly."; 301 | } 302 | else 303 | { 304 | ViewBodesButton.Enabled = false; 305 | StatusLamp.ForeColor = Color.FromArgb(UINT8_MAX, 0, 0); 306 | LogMessageValue.ForeColor = Color.FromArgb(UINT8_MAX, 0, 0); 307 | // Output the error that avoid computing the filter's data 308 | if (error_flag == ERROR_TYPE) 309 | { 310 | LogMessageValue.Text = "This type of filter is not supported."; 311 | } 312 | else if (error_flag == ERROR_ORDER) 313 | { 314 | LogMessageValue.Text = "This order value is not supported for such filters" + Environment.NewLine + "It must be an even value."; 315 | } 316 | else 317 | { 318 | LogMessageValue.Text = "An unexpected error occured."; 319 | } 320 | } 321 | } 322 | else 323 | { 324 | StatusLamp.ForeColor = Color.FromArgb(UINT8_MAX, 0, 0); 325 | LogMessageValue.ForeColor = Color.FromArgb(UINT8_MAX, 0, 0); 326 | LogMessageValue.Text = "Do not let empty parameters fields." + Environment.NewLine + 327 | "As a result, the text fields are reset." + Environment.NewLine + 328 | "Please, enter numbers [0-9 .]"; 329 | // Reset all text field value 330 | CutoffFrequencyValue.Text = "1"; 331 | QualityFactorValue.Text = "1"; 332 | LinearGainValue.Text = "1"; 333 | ViewBodesButton.Enabled = false; 334 | } 335 | } 336 | 337 | private void ViewBodesButton_Click(object sender, EventArgs e) 338 | { 339 | // If the current plot is the first one there is no need to clear the values series 340 | if (first_plot == false) 341 | { 342 | cartesianChartMod.Series[0].Values.Clear(); 343 | cartesianChartArg.Series[0].Values.Clear(); 344 | } 345 | // Addi new data points to the existing series 346 | cartesianChartMod.Series.Add(new LineSeries 347 | { 348 | Values = ValuesMod, 349 | Stroke = System.Windows.Media.Brushes.Blue, 350 | StrokeThickness = PLOT_STROKE, 351 | Fill = new System.Windows.Media.SolidColorBrush 352 | { 353 | Color = System.Windows.Media.Color.FromRgb(128, 128, 255), 354 | Opacity = PLOT_OPACITY 355 | }, 356 | PointGeometry = null 357 | }); 358 | cartesianChartArg.Series.Add(new LineSeries 359 | { 360 | Values = ValuesArg, 361 | Stroke = System.Windows.Media.Brushes.Blue, 362 | StrokeThickness = PLOT_STROKE, 363 | Fill = new System.Windows.Media.SolidColorBrush 364 | { 365 | Color = System.Windows.Media.Color.FromRgb(128, 128, 255), 366 | Opacity = PLOT_OPACITY 367 | }, 368 | PointGeometry = null 369 | }); 370 | 371 | // Display the results in the LiveCharts 372 | int j = 0; 373 | for (int i = 0; i < NB_POINTS/RATIO; i++) 374 | { 375 | cartesianChartMod.Series[0].Values.Insert(j, new ObservablePoint(f[i*RATIO], H_mod[i*RATIO])); 376 | cartesianChartArg.Series[0].Values.Insert(j, new ObservablePoint(f[i*RATIO], H_arg[i*RATIO])); 377 | j++; 378 | } 379 | first_plot = false; 380 | // Clear the Status lamp 381 | StatusLamp.ForeColor = Color.FromArgb(227, 227, 227); 382 | ; 383 | } 384 | } 385 | } 386 | -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/UIFigure.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 122 | 123 | AAABAAIAEBAAAAAAIABoBAAAJgAAACAgAAAAACAAqBAAAI4EAAAoAAAAEAAAACAAAAABACAAAAAAAEAE 124 | AAAAAAAAAAAAAAAAAAAAAAAA////Af///wH///8B////Af///wH///8BPL/5DTu/+Bk1tfUF////Af// 125 | /wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8BNK/1Azy693k8uvjZO6b2ZzCE 126 | 6gf///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////ATVy4Rs6j+7NO5Pv/zyK 127 | 8e88f/FjNXnqB////wH///8B////ATpNvAM8SLsD////Af///wH///8B////AQgSbwMgLp9lLEe89TRe 128 | 1v84bOX/O3nv4TyB8EsugfQD////ASw/wgM7QcQzNzzBJf///wH///8B0ZM+D82RRkuFXUJZHBpw1xwi 129 | jf8nNqr/MFDK/zht5v88gu/VO4rxSzts5Rc4QtFPMDfImy0xvxnJoToD3KFDI9meQKHSlkT1u4RF+Vk+ 130 | R/8ZGG7/HSKO/yk6r/81X9r/O4Dt/zyK8e05aerPMj7R7S4zw3cnK7YF3aRPNd6lTMfZoET90pg//8eN 131 | Sv+kdEj/PCpO/xcZe/8iLJz/MlXO/zt/6/87h+7/Nlzi/zA5yecsMb81////AdqhUh/ao1J33KNLydid 132 | QvPJj0n9mm9P/1M5Qv8fGWD/HCKM/y5Lwv87f+r/O4Tt/zRP2v8vNsWxLDK/Df///wH///8ByJ5JA9ug 133 | TBnZnkJVs39Ht1A0RPsxHkT/OCZI/xkbev8qQrb/OoPq/zqC7P8yRtT5LjTDaxcXtgP///8B////Af// 134 | /wH///8B////AXZRNBeRYi6xd08y+Vs9O/8lHmH/Jjmq/zmK6v85fur/MT/O3ywywS3///8B////Af// 135 | /wH///8B////Af///wH///8ByIstIapzJYeVZCTjTzdF/yIxmv84luj/N3nm/zA6yq0sLr8P////Af// 136 | /wH///8B////Af///wH///8B////Af///wGLZjwFsHcdS4tdK98oLoH/N6Lh/zZx4PkuNsZpKSm7A/// 137 | /wH///8B////Af///wH///8B////Af///wH///8B////AbB6KAWncCRtQzpk9Tab1v80ZdnbLDPCKf// 138 | /wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8Bt30nEWlQT7c1dMH7MlTSjSUn 139 | uQn///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af///wGDXkU5Oj2Ujyo2 140 | vSP///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8BkFI/A0Ut 141 | aQf///8B////Af///wH///8B////AQAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA 142 | //8AAP//AAD//wAA//8AAP//AAD//wAA//8oAAAAIAAAAEAAAAABACAAAAAAAIAQAAAAAAAAAAAAAAAA 143 | AAAAAAAA////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af// 144 | /wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af// 145 | /wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af// 146 | /wE8u/cJPMD5KzzB+Ts7vPcnN7P1DyO+9QP///8B////Af///wH///8B////Af///wH///8B////Af// 147 | /wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af// 148 | /wH///8BMsv/Azq69Sk8v/iZPMH50Ty7+KU6sfZZNab1Gw+K0AP///8B////Af///wH///8B////Af// 149 | /wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af// 150 | /wH///8B////Af///wE0rPQLPLb3UTy499E8uff7PbT48T2o9787mfJpNoXsGf///wH///8B////Af// 151 | /wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af// 152 | /wH///8B////Af///wH///8B////ATiU8x88n/OLPab17Tyj8v88nvL/PZf0+TyO8888hPBhOH3sFRh4 153 | 8gP///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af// 154 | /wH///8B////Af///wH///8B////Af///wEvUMgJNWfcRzh45sE5guv7OoXs/zqE7f87gu7/PIHx+z1+ 155 | 88E8e+9VOHjpEzZ+7AP///8B////Af///wH///8B////Af///wH///8BOk29BT5NvAk0OLgD////Af// 156 | /wH///8B////Af///wH///8B////Af///wH///8B////AR4xoBkpQLV9L1DH4zNe1P02Z97/N23k/zlw 157 | 6P86dev/PHrw8T198ak8f/BHN4DtD////wH///8B////Af///wH///8B////AURIwAlBR8QlPkXCKzI1 158 | vg////8B////Af///wH///8B////Af///wH///8B////Af///wEJEW0JFh6JRR8nl7kkMaT3Kj+z/y9M 159 | xf8yV9L/NmHc/zdp5P85dOz9PHzw5zyB8Zk7g+87LYH1C////wH///8B////Af///wEsP8MJOj/GNTk+ 160 | xGk2O8FLLzG+Ef///wH///8B////Af///wH///8B0ItFA8uLRQ/GikQXqnM5ETAlWS8VF3aTGBuE6R0i 161 | jv0iK5v/KDes/yxEu/8xUcv/NF3a/zhr5v86d+z9PIDu4TyF8I06iPMzLormB////wH///8BSVDZCTY/ 162 | yjUzOcmNMDbFlS0xvz0qK7kH////Af///wH///8B////AdqTMgnPkz8x0ZRGdcuQR5O8hD6Bb0w/pyof 163 | WucXFnD9Fxt//xogi/8hKZn/JjSo/ytCuf8wUMv/NWHd/zlw6f87fu39PIfw5zyM8qE7iPBNOXrnKz5g 164 | 4i09TNhXNT3PqzA3ytEuNMZ7LjG/HzAwsAP///8B////AeeiRQPhpEAP2Jw+Q9abQJ3UmETjz5NI98aN 165 | R+2hcD33XD5C/yYcWP8WF2//Fxt//xwhjf8hKpr/Jzer/y1Gv/8zWdX/OGvl/zt77P88h+//PI3y8TuJ 166 | 8sU6ee6lOl/lqTZI2c0xOc7xLjTGxS0ywFEnLLgN////Af///wHMoj0F26JGHdugQ1vboUG12Z5A79SY 167 | QP/QlEX/ypBL/7yFR/+TZj7/TzZE/yAYW/8VFnL/GByD/x0jkP8kL6D/Kj60/zJSzf83Z+H/Onnq/zyG 168 | 7f88jPD/O4bx/Tp17/c3WuX5MkPW/S83yfUuM8ObLDC9LyoqtAX///8B36VLB9qkSy3epUp73KNGzdyi 169 | RPfXnUD/05k+/9CVQf/LkEj/wYlN/7B9SP+DWj//PypI/xkVYf8WGHn/Gh+I/yAol/8nN6r/MEzF/zZj 170 | 3f86d+r/PIbt/zyM7v87g+7/OW7q/zVS3v8xPtD/LjXF4y0ywW8qLLwX////Af///wHaoE4b3qVQgeGo 171 | UNvepkz52qFI/9efQ//UnD//0Zc//8yRRv/Cik3/t4RQ/6R1Sv9sS0H/Kx5P/xYUbP8XG3//HSOP/yQv 172 | of8tRr7/NV/Z/zp26P88h+3/PIzu/zqA7f84Z+b/M0vY/zA6y/0uNMO/LDK+RSUltwn///8B////Adec 173 | UhXco1Nd26RTm9ykUcndpE3n2qJH99ifQv3UmUD/zpNF/8OLTf+1g1H/oHNR/3pVRP9FL0H/HRZa/xYX 174 | dP8aHob/ISmZ/ys/tf8zW9X/OXXn/zyI7v88jO//On3s/zdf4/8yRNT/LzfI8y40wpEtM8AhADPMA/// 175 | /wH///8B////AdKYUwvSnVMn16NST9ujT4fcokq726BE29icQPHRlUX7wYpM/6N1Tv9xT03/STFG/0Uu 176 | Pf8uIEr/GRVm/xgafv8eJZL/KDqu/zJX0P85deb/PIru/zyO7/86eev/Nlng/zFA0f8vNsfdLjTBZS8v 177 | vA////8B////Af///wH///8B////Af///wHNoE4H2KFQHdygSj/aoERz2ZxBpdKWRtGvfEj1c09H/z0n 178 | R/8lF0b/NyNA/0AqQP8jGlf/Fxhz/xsgiv8mNKf/MVTM/zl25v87ju//O5Dv/zl16v80U9z/MT3O+y81 179 | xbstM8A/Ghq0B////wH///8B////Af///wH///8B////Af///wH///8B25lMBduhQxHankQtyZFMYYde 180 | Q7dSNUHzPCVD/zMfRP82IUT/SC8//zQkSv8aF2f/GByC/yMvoP8wUcf/OHfl/zuS7/86kvD/OXHo/zNO 181 | 2f8vOsztLTPDkywvviH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Ad+j 182 | SwOGaEQHaUc4R3hQM7l4UDPzZkQ3/VE1Pv9TNj7/SjFB/yYdWP8YGXf/ICqY/y5Nwv84eeP/O5fw/zuT 183 | 8P83a+b/MkfV/S83yNUtM8JlLC+7D////wH///8B////Af///wH///8B////Af///wH///8B////Af// 184 | /wH///8B////Af///wGueR8PuX8mW7d8KL2kbifvhlks+25JNP9iQjn/OylK/xsZa/8dJZD/LEm9/zd7 185 | 4v87n/H/OpXw/zZl4/8yQ9L3LzbGsywxwD8dILcF////Af///wH///8B////Af///wH///8B////Af// 186 | /wH///8B////Af///wH///8B////Ad+fLwPWmC8XyYsrW7h9JaembyHVkmEl84NXLP1aPTz/Jh5d/xsg 187 | hv8qRbb/Nn7g/zqn8f86l+//Nl/g/zE/z+svNcWNLjDAJSsrvQP///8B////Af///wH///8B////Af// 188 | /wH///8B////Af///wH///8B////Af///wH///8B////Ab+PLwOtezURnmwzNaFuJmmkbx+zoWsf6YBV 189 | Lf08K03/HB17/yhAr/81g97/ObHx/zmY7v81WNz9MDvK1y4zwmcoKb8T////Af///wH///8B////Af// 190 | /wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af///wFnTE8DlGw4Dad0 191 | I0OydhujoWsh6V9BPf0iH2z/JTum/zSH2f86uu7/OZfr/zRR2PkwOcm1LTLBQSkpvAf///8B////Af// 192 | /wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af// 193 | /wH///8BrncgB7h8HT21eh2nhVou7TQnWv8jNpj/NIjS/zy+6v84j+f/MknU6y81x4crMb4jKyu4A/// 194 | /wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af// 195 | /wH///8B////Af///wH///8BsnsnD7l8H1ecaCfBTzhL+Sczif8yhMv/O7rn/ziF5P8wRNDPLTPEWycv 196 | vg////8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af// 197 | /wH///8B////Af///wH///8B////Af///wGpcRwDtHkeHapzJXlqST7hMTV4/TB9wf86r+T/Nnff+TA/ 198 | zaMrM8E1Iyy0B////wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af// 199 | /wH///8B////Af///wH///8B////Af///wH///8B////Af///wGtcyIFtn4nM4ZbN69FPmfzMXCz/ziZ 200 | 4P81aNrlMDrJbScqvRf///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af// 201 | /wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af///wG9fykLo3EzZV9L 202 | V9M3WZ/5M2/S9TJU0q0tMcEzHh6tB////wH///8B////Af///wH///8B////Af///wH///8B////Af// 203 | /wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af// 204 | /wG5gC4jdFVMh0FChs0vQre7LT3DXSoquQ////8B////Af///wH///8B////Af///wH///8B////Af// 205 | /wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af// 206 | /wH///8B////AcKGIAd/V0UxSThvYS4qllEjJqwbAAC+A////wH///8B////Af///wH///8B////Af// 207 | /wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af// 208 | /wH///8B////Af///wH///8B////AYxQQAdRN10PNSF4CxYLggP///8B////Af///wH///8B////Af// 209 | /wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af// 210 | /wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af// 211 | /wH///8B////Af///wH///8B////AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 212 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 213 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 214 | 215 | 216 | -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/bin/x64/Debug/GUI.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/bin/x64/Debug/GUI.exe -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/bin/x64/Debug/GUI.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/bin/x64/Debug/GUI.pdb -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/bin/x64/Debug/KnobControl.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/bin/x64/Debug/KnobControl.dll -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/bin/x64/Debug/Lamp.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/bin/x64/Debug/Lamp.dll -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/bin/x64/Debug/LiveCharts.WinForms.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/bin/x64/Debug/LiveCharts.WinForms.dll -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/bin/x64/Debug/LiveCharts.WinForms.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/bin/x64/Debug/LiveCharts.WinForms.pdb -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/bin/x64/Debug/LiveCharts.Wpf.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/bin/x64/Debug/LiveCharts.Wpf.dll -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/bin/x64/Debug/LiveCharts.Wpf.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/bin/x64/Debug/LiveCharts.Wpf.pdb -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/bin/x64/Debug/LiveCharts.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/bin/x64/Debug/LiveCharts.dll -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/bin/x64/Debug/LiveCharts.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/bin/x64/Debug/LiveCharts.pdb -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/bin/x64/Debug/filter_bode.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/bin/x64/Debug/filter_bode.dll -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/bin/x64/Release/GUI.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/bin/x64/Release/GUI.exe -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/bin/x64/Release/GUI.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/bin/x64/Release/GUI.pdb -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/bin/x64/Release/KnobControl.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/bin/x64/Release/KnobControl.dll -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/bin/x64/Release/Lamp.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/bin/x64/Release/Lamp.dll -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/bin/x64/Release/LiveCharts.WinForms.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/bin/x64/Release/LiveCharts.WinForms.dll -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/bin/x64/Release/LiveCharts.WinForms.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/bin/x64/Release/LiveCharts.WinForms.pdb -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/bin/x64/Release/LiveCharts.Wpf.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/bin/x64/Release/LiveCharts.Wpf.dll -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/bin/x64/Release/LiveCharts.Wpf.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/bin/x64/Release/LiveCharts.Wpf.pdb -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/bin/x64/Release/LiveCharts.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/bin/x64/Release/LiveCharts.dll -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/bin/x64/Release/LiveCharts.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/bin/x64/Release/LiveCharts.pdb -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/bin/x64/Release/filter_bode.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/bin/x64/Release/filter_bode.dll -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/favicon.ico -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/filter_bode.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/filter_bode.dll -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/filter_bode_ML.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/filter_bode_ML.dll -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/filter_bode_VS.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/filter_bode_VS.dll -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/packages/LiveCharts.0.9.7/LiveCharts.0.9.7.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/packages/LiveCharts.0.9.7/LiveCharts.0.9.7.nupkg -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/packages/LiveCharts.0.9.7/lib/net40/LiveCharts.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/packages/LiveCharts.0.9.7/lib/net40/LiveCharts.dll -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/packages/LiveCharts.0.9.7/lib/net40/LiveCharts.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/packages/LiveCharts.0.9.7/lib/net40/LiveCharts.pdb -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/packages/LiveCharts.0.9.7/lib/net45/LiveCharts.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/packages/LiveCharts.0.9.7/lib/net45/LiveCharts.dll -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/packages/LiveCharts.0.9.7/lib/net45/LiveCharts.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/packages/LiveCharts.0.9.7/lib/net45/LiveCharts.pdb -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/packages/LiveCharts.0.9.7/lib/portable-net45+win8+wp8/LiveCharts.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/packages/LiveCharts.0.9.7/lib/portable-net45+win8+wp8/LiveCharts.dll -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/packages/LiveCharts.0.9.7/lib/portable-net45+win8+wp8/LiveCharts.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/packages/LiveCharts.0.9.7/lib/portable-net45+win8+wp8/LiveCharts.pdb -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/packages/LiveCharts.0.9.7/readme.txt: -------------------------------------------------------------------------------- 1 | ================================== 2 | <<<<<<<<<<< IMPORTANT >>>>>>>>>>>> 3 | ================================== 4 | 5 | LiveCharts is now multipatform (at least the design). 6 | 7 | So this package contains nothing but the core of the library, 8 | you might also need to install the desired platform. 9 | 10 | For example if using wpf you must also install the wpf package. 11 | 12 | ------------------------------------ 13 | > Install-Package LiveCharts.Wpf 14 | ------------------------------------ 15 | 16 | For future updates, you will only need to update LiveCharts.Wpf (or any other platform) 17 | forget about the core, all the platforms packages will have a dependency to core. 18 | 19 | ------------------------------------ 20 | > Update-Package LiveCharts.Wpf 21 | ------------------------------------ 22 | 23 | Happy coding! -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/packages/LiveCharts.WinForms.0.9.7.1/LiveCharts.WinForms.0.9.7.1.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/packages/LiveCharts.WinForms.0.9.7.1/LiveCharts.WinForms.0.9.7.1.nupkg -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/packages/LiveCharts.WinForms.0.9.7.1/lib/net40/LiveCharts.WinForms.XML: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | LiveCharts.WinForms 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | The WPF base 16 | 17 | 18 | 19 | 20 | Initializes a new instance of the class. 21 | 22 | 23 | 24 | 25 | Gets the base. 26 | 27 | 28 | The base. 29 | 30 | 31 | 32 | 33 | Gets or sets the wedge. 34 | 35 | 36 | The wedge. 37 | 38 | 39 | 40 | 41 | Gets or sets the tick step. 42 | 43 | 44 | The tick step. 45 | 46 | 47 | 48 | 49 | Gets or sets the labels step. 50 | 51 | 52 | The labels step. 53 | 54 | 55 | 56 | 57 | Gets or sets from value. 58 | 59 | 60 | From value. 61 | 62 | 63 | 64 | 65 | Gets or sets to value. 66 | 67 | 68 | To value. 69 | 70 | 71 | 72 | 73 | Gets or sets the sections. 74 | 75 | 76 | The sections. 77 | 78 | 79 | 80 | 81 | Gets or sets the value. 82 | 83 | 84 | The value. 85 | 86 | 87 | 88 | 89 | Gets or sets the label formatter. 90 | 91 | 92 | The label formatter. 93 | 94 | 95 | 96 | 97 | Gets or sets a value indicating whether [disable animations]. 98 | 99 | 100 | true if [disable animations]; otherwise, false. 101 | 102 | 103 | 104 | 105 | Gets or sets the animations speed. 106 | 107 | 108 | The animations speed. 109 | 110 | 111 | 112 | 113 | Gets or sets the ticks foreground. 114 | 115 | 116 | The ticks foreground. 117 | 118 | 119 | 120 | 121 | Gets or sets the sections inner radius. 122 | 123 | 124 | The sections inner radius. 125 | 126 | 127 | 128 | 129 | Gets or sets the needle fill. 130 | 131 | 132 | The needle fill. 133 | 134 | 135 | 136 | 137 | Gets or sets the labels effect. 138 | 139 | 140 | The labels effect. 141 | 142 | 143 | 144 | 145 | Gets or sets the ticks stroke thickness. 146 | 147 | 148 | The ticks stroke thickness. 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | The WPF base 160 | 161 | 162 | 163 | 164 | Initializes a new instance of the class. 165 | 166 | 167 | 168 | 169 | Updates the specified restart view. 170 | 171 | if set to true [restart view]. 172 | if set to true [force]. 173 | 174 | 175 | 176 | Occurs when the users clicks any point in the chart 177 | 178 | 179 | 180 | 181 | Occurs when the users hovers over any point in the chart 182 | 183 | 184 | 185 | 186 | Occurs every time the chart updates 187 | 188 | 189 | 190 | 191 | Gets the base. 192 | 193 | 194 | The base. 195 | 196 | 197 | 198 | 199 | Gets or sets the axis y. 200 | 201 | 202 | The axis y. 203 | 204 | 205 | 206 | 207 | Gets or sets the axis x. 208 | 209 | 210 | The axis x. 211 | 212 | 213 | 214 | 215 | Gets or sets the default legend. 216 | 217 | 218 | The default legend. 219 | 220 | 221 | 222 | 223 | Gets or sets the zoom. 224 | 225 | 226 | The zoom. 227 | 228 | 229 | 230 | 231 | Gets or sets the pan. 232 | 233 | 234 | The pan. 235 | 236 | 237 | 238 | 239 | Gets or sets the legend location. 240 | 241 | 242 | The legend location. 243 | 244 | 245 | 246 | 247 | Gets or sets the series. 248 | 249 | 250 | The series. 251 | 252 | 253 | 254 | 255 | Gets or sets the animations speed. 256 | 257 | 258 | The animations speed. 259 | 260 | 261 | 262 | 263 | Gets or sets a value indicating whether [disable animations]. 264 | 265 | 266 | true if [disable animations]; otherwise, false. 267 | 268 | 269 | 270 | 271 | Gets or sets the data tooltip. 272 | 273 | 274 | The data tooltip. 275 | 276 | 277 | 278 | 279 | Gets or sets a value indicating whether this is hoverable. 280 | 281 | 282 | true if hoverable; otherwise, false. 283 | 284 | 285 | 286 | 287 | Gets or sets the scroll mode. 288 | 289 | 290 | The scroll mode. 291 | 292 | 293 | 294 | 295 | Gets or sets the scroll horizontal from. 296 | 297 | 298 | The scroll horizontal from. 299 | 300 | 301 | 302 | 303 | Gets or sets the scroll horizontal to. 304 | 305 | 306 | The scroll horizontal to. 307 | 308 | 309 | 310 | 311 | Gets or sets the scroll vertical from. 312 | 313 | 314 | The scroll vertical from. 315 | 316 | 317 | 318 | 319 | Gets or sets the scroll vertical to. 320 | 321 | 322 | The scroll vertical to. 323 | 324 | 325 | 326 | 327 | Gets or sets the scroll bar fill. 328 | 329 | 330 | The scroll bar fill. 331 | 332 | 333 | 334 | 335 | Gets or sets the background. 336 | 337 | 338 | The background. 339 | 340 | 341 | 342 | 343 | Gets or sets the visual elements. 344 | 345 | 346 | The visual elements. 347 | 348 | 349 | 350 | 351 | Gets or sets the state of the updater. 352 | 353 | 354 | The state of the updater. 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | The WPF base 366 | 367 | 368 | 369 | 370 | Initializes a new instance of the class. 371 | 372 | 373 | 374 | 375 | Gets the base. 376 | 377 | 378 | The base. 379 | 380 | 381 | 382 | 383 | Gets or sets a value indicating whether [uses360 mode]. 384 | 385 | 386 | true if [uses360 mode]; otherwise, false. 387 | 388 | 389 | 390 | 391 | Gets or sets a value indicating whether [disable animations]. 392 | 393 | 394 | true if [disable animations]; otherwise, false. 395 | 396 | 397 | 398 | 399 | Gets or sets from. 400 | 401 | 402 | From. 403 | 404 | 405 | 406 | 407 | Gets or sets to. 408 | 409 | 410 | To. 411 | 412 | 413 | 414 | 415 | Gets or sets the value. 416 | 417 | 418 | The value. 419 | 420 | 421 | 422 | 423 | Gets or sets the inner radius. 424 | 425 | 426 | The inner radius. 427 | 428 | 429 | 430 | 431 | Gets or sets the stroke. 432 | 433 | 434 | The stroke. 435 | 436 | 437 | 438 | 439 | Gets or sets the stroke thickness. 440 | 441 | 442 | The stroke thickness. 443 | 444 | 445 | 446 | 447 | Gets or sets to color. 448 | 449 | 450 | To color. 451 | 452 | 453 | 454 | 455 | Gets or sets from color. 456 | 457 | 458 | From color. 459 | 460 | 461 | 462 | 463 | Gets or sets the gauge background. 464 | 465 | 466 | The gauge background. 467 | 468 | 469 | 470 | 471 | Gets or sets the animations speed. 472 | 473 | 474 | The animations speed. 475 | 476 | 477 | 478 | 479 | Gets or sets the label formatter. 480 | 481 | 482 | The label formatter. 483 | 484 | 485 | 486 | 487 | Gets or sets the size of the high font. 488 | 489 | 490 | The size of the high font. 491 | 492 | 493 | 494 | 495 | Gets or sets the size of the font. 496 | 497 | 498 | The size of the font. 499 | 500 | 501 | 502 | 503 | Gets or sets the font family. 504 | 505 | 506 | The font family. 507 | 508 | 509 | 510 | 511 | Gets or sets the font weight. 512 | 513 | 514 | The font weight. 515 | 516 | 517 | 518 | 519 | Gets or sets the font style. 520 | 521 | 522 | The font style. 523 | 524 | 525 | 526 | 527 | Gets or sets the font stretch. 528 | 529 | 530 | The font stretch. 531 | 532 | 533 | 534 | 535 | Gets or sets the fore ground. 536 | 537 | 538 | The fore ground. 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | The WPF base 550 | 551 | 552 | 553 | 554 | Initializes a new instance of the class. 555 | 556 | 557 | 558 | 559 | Occurs when [land click]. 560 | 561 | 562 | 563 | 564 | Gets the base. 565 | 566 | 567 | The base. 568 | 569 | 570 | 571 | 572 | Gets or sets the language pack. 573 | 574 | 575 | The language pack. 576 | 577 | 578 | 579 | 580 | Gets or sets the default land fill. 581 | 582 | 583 | The default land fill. 584 | 585 | 586 | 587 | 588 | Gets or sets the land stroke thickness. 589 | 590 | 591 | The land stroke thickness. 592 | 593 | 594 | 595 | 596 | Gets or sets the land stroke. 597 | 598 | 599 | The land stroke. 600 | 601 | 602 | 603 | 604 | Gets or sets a value indicating whether [disable animations]. 605 | 606 | 607 | true if [disable animations]; otherwise, false. 608 | 609 | 610 | 611 | 612 | Gets or sets the animations speed. 613 | 614 | 615 | The animations speed. 616 | 617 | 618 | 619 | 620 | Gets or sets a value indicating whether this is hoverable. 621 | 622 | 623 | true if hoverable; otherwise, false. 624 | 625 | 626 | 627 | 628 | Gets or sets the heat map. 629 | 630 | 631 | The heat map. 632 | 633 | 634 | 635 | 636 | Gets or sets the gradient stop collection. 637 | 638 | 639 | The gradient stop collection. 640 | 641 | 642 | 643 | 644 | Gets or sets the source. 645 | 646 | 647 | The source. 648 | 649 | 650 | 651 | 652 | Gets or sets a value indicating whether [enable zooming and panning]. 653 | 654 | 655 | true if [enable zooming and panning]; otherwise, false. 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | The WPF base 667 | 668 | 669 | 670 | 671 | Initializes a new instance of the class. 672 | 673 | 674 | 675 | 676 | Updates the specified restart view. 677 | 678 | if set to true [restart view]. 679 | if set to true [force]. 680 | 681 | 682 | 683 | Occurs when the users clicks any point in the chart 684 | 685 | 686 | 687 | 688 | Occurs when the users hovers over any point in the chart 689 | 690 | 691 | 692 | 693 | Occurs every time the chart updates 694 | 695 | 696 | 697 | 698 | Gets or sets the axis y. 699 | 700 | 701 | The axis y. 702 | 703 | 704 | 705 | 706 | Gets or sets the axis x. 707 | 708 | 709 | The axis x. 710 | 711 | 712 | 713 | 714 | Gets or sets the default legend. 715 | 716 | 717 | The default legend. 718 | 719 | 720 | 721 | 722 | Gets or sets the zoom. 723 | 724 | 725 | The zoom. 726 | 727 | 728 | 729 | 730 | Gets or sets the legend location. 731 | 732 | 733 | The legend location. 734 | 735 | 736 | 737 | 738 | Gets or sets the series. 739 | 740 | 741 | The series. 742 | 743 | 744 | 745 | 746 | Gets or sets the animations speed. 747 | 748 | 749 | The animations speed. 750 | 751 | 752 | 753 | 754 | Gets or sets a value indicating whether [disable animations]. 755 | 756 | 757 | true if [disable animations]; otherwise, false. 758 | 759 | 760 | 761 | 762 | Gets or sets the data tooltip. 763 | 764 | 765 | The data tooltip. 766 | 767 | 768 | 769 | 770 | Gets or sets the inner radius. 771 | 772 | 773 | The inner radius. 774 | 775 | 776 | 777 | 778 | Gets or sets the starting rotation angle. 779 | 780 | 781 | The starting rotation angle. 782 | 783 | 784 | 785 | 786 | Gets or sets the state of the updater. 787 | 788 | 789 | The state of the updater. 790 | 791 | 792 | 793 | 794 | Gets or sets the units that a slice is pushed out when a user moves the mouse over data point. 795 | 796 | 797 | The hover push out. 798 | 799 | 800 | 801 | 802 | -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/packages/LiveCharts.WinForms.0.9.7.1/lib/net40/LiveCharts.WinForms.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/packages/LiveCharts.WinForms.0.9.7.1/lib/net40/LiveCharts.WinForms.dll -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/packages/LiveCharts.WinForms.0.9.7.1/lib/net40/LiveCharts.WinForms.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/packages/LiveCharts.WinForms.0.9.7.1/lib/net40/LiveCharts.WinForms.pdb -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/packages/LiveCharts.WinForms.0.9.7.1/lib/net45/LiveCharts.WinForms.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/packages/LiveCharts.WinForms.0.9.7.1/lib/net45/LiveCharts.WinForms.dll -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/packages/LiveCharts.WinForms.0.9.7.1/lib/net45/LiveCharts.WinForms.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/packages/LiveCharts.WinForms.0.9.7.1/lib/net45/LiveCharts.WinForms.pdb -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/packages/LiveCharts.WinForms.0.9.7.1/tools/install.ps1: -------------------------------------------------------------------------------- 1 | param($installPath, $toolsPath, $package, $project) 2 | 3 | $DTE.ItemOperations.Navigate("https://lvcharts.net/thanks/wpf") -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/packages/LiveCharts.Wpf.0.9.7/LiveCharts.Wpf.0.9.7.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/packages/LiveCharts.Wpf.0.9.7/LiveCharts.Wpf.0.9.7.nupkg -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/packages/LiveCharts.Wpf.0.9.7/lib/net40/LiveCharts.Wpf.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/packages/LiveCharts.Wpf.0.9.7/lib/net40/LiveCharts.Wpf.dll -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/packages/LiveCharts.Wpf.0.9.7/lib/net40/LiveCharts.Wpf.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/packages/LiveCharts.Wpf.0.9.7/lib/net40/LiveCharts.Wpf.pdb -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/packages/LiveCharts.Wpf.0.9.7/lib/net45/LiveCharts.Wpf.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/packages/LiveCharts.Wpf.0.9.7/lib/net45/LiveCharts.Wpf.dll -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/packages/LiveCharts.Wpf.0.9.7/lib/net45/LiveCharts.Wpf.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/GUI/packages/LiveCharts.Wpf.0.9.7/lib/net45/LiveCharts.Wpf.pdb -------------------------------------------------------------------------------- /C_project/CS_GUI/GUI/packages/LiveCharts.Wpf.0.9.7/tools/install.ps1: -------------------------------------------------------------------------------- 1 | param($installPath, $toolsPath, $package, $project) 2 | 3 | $DTE.ItemOperations.Navigate("https://lvcharts.net/thanks/wpf") -------------------------------------------------------------------------------- /C_project/CS_GUI/KnobControl/bin/Debug/KnobControl.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/KnobControl/bin/Debug/KnobControl.dll -------------------------------------------------------------------------------- /C_project/CS_GUI/KnobControl/bin/Release/KnobControl.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/KnobControl/bin/Release/KnobControl.dll -------------------------------------------------------------------------------- /C_project/CS_GUI/LampControl/Debug/Lamp.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/LampControl/Debug/Lamp.dll -------------------------------------------------------------------------------- /C_project/CS_GUI/LampControl/Release/Lamp.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/LampControl/Release/Lamp.dll -------------------------------------------------------------------------------- /C_project/CS_GUI/M_Algorithm/C_codegen.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Script: C_codegen 3 | % Goal : Generates C code out of the following filter function: 4 | % [H_mod,H_arg,error_flag] = filter_bode(f,f_0,q_0,g,f_type,f_order) 5 | % 6 | % Copyright 2024 The MathWorks, Inc. 7 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8 | clear variables; clc; 9 | 10 | % Constants 11 | BUILD_FOLDER = 'Artifacts'; 12 | ZIP_FILE = 'MATLAB.zip'; 13 | ZIP_FILE_PATH = [BUILD_FOLDER '\' ZIP_FILE ]; 14 | VS20XY_PROJECT = '..\GUI'; 15 | 16 | % Fully remove previous generated folder and files 17 | if exist(BUILD_FOLDER,'dir') 18 | rmdir(BUILD_FOLDER, 's'); 19 | end 20 | % Create an empty directory for the build 21 | mkdir(BUILD_FOLDER); 22 | disp('Build folder cleaned successfully.'); 23 | 24 | % Define the configuration object for the C code to generate 25 | cfg = coder.config('dll'); 26 | cfg.FilePartitionMethod = 'SingleFile'; 27 | % Generate C code only 28 | codegen filter_bode -config cfg -c -d '.\Artifacts' -args {zeros(1,1e005),0,0,0,char(zeros(1,5)),int32(0)} 29 | disp('C code generated successfully.'); 30 | % Package the artifacts 31 | load([BUILD_FOLDER '\buildinfo.mat']); 32 | packNGo(buildInfo,'fileName',ZIP_FILE_PATH); 33 | disp('ZIP file created successfully.'); 34 | % Generate DLL 35 | codegen filter_bode_DLL -config cfg -d '.\Artifacts' -o filter_bode_ML -args {zeros(1,1e005),0,0,0,char(zeros(1,5)),int32(0)} 36 | disp('DLL generated successfully.'); 37 | 38 | % Move the artifacts to Visual Studio SLN project location 39 | copyfile([BUILD_FOLDER '\filter_bode_ML.dll'],VS20XY_PROJECT); 40 | disp('DLL copied successfully to VS20XY.'); 41 | copyfile(ZIP_FILE_PATH,VS20XY_PROJECT); 42 | unzip([VS20XY_PROJECT '\' ZIP_FILE],[VS20XY_PROJECT '\MatlabDLL\C_Codegen']); 43 | disp('C files extracted successfully in VS20XY.'); 44 | delete([VS20XY_PROJECT '\' ZIP_FILE]); 45 | rmdir(BUILD_FOLDER, 's'); 46 | delete('buildInfo.mat'); 47 | disp('Build folder removed successfully.'); 48 | -------------------------------------------------------------------------------- /C_project/CS_GUI/M_Algorithm/filter_bode.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/M_Algorithm/filter_bode.m -------------------------------------------------------------------------------- /C_project/CS_GUI/M_Algorithm/filter_bode_DLL.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/CS_GUI/M_Algorithm/filter_bode_DLL.m -------------------------------------------------------------------------------- /C_project/C_DISLIN/Dev-Cpp/Filter_Design.dev: -------------------------------------------------------------------------------- 1 | [Project] 2 | FileName=Filter_Design.dev 3 | Name=Filter_bode 4 | Type=1 5 | Ver=2 6 | ObjFiles= 7 | Includes= 8 | Libs= 9 | PrivateResource= 10 | ResourceIncludes= 11 | MakeIncludes= 12 | Compiler= 13 | CppCompiler=-I"C:\dislin\real64"_@@_ 14 | Linker="C:\dislin\dismg_d.a" -luser32 -lgdi32 -lopengl32 -static-libgcc_@@_ 15 | IsCpp=0 16 | Icon= 17 | ExeOutput= 18 | ObjectOutput= 19 | LogOutput= 20 | LogOutputEnabled=0 21 | OverrideOutput=0 22 | OverrideOutputName=Filter_Design.exe 23 | HostApplication= 24 | UseCustomMakefile=0 25 | CustomMakefile= 26 | CommandLine= 27 | Folders= 28 | IncludeVersionInfo=0 29 | SupportXPThemes=0 30 | CompilerSet=1 31 | CompilerSettings=0000000000000000001000000 32 | UnitCount=4 33 | 34 | [VersionInfo] 35 | Major=1 36 | Minor=0 37 | Release=0 38 | Build=0 39 | LanguageID=1033 40 | CharsetID=1252 41 | CompanyName= 42 | FileVersion=1.0.0.0 43 | FileDescription=Developed using the Dev-C++ IDE 44 | InternalName= 45 | LegalCopyright= 46 | LegalTrademarks= 47 | OriginalFilename= 48 | ProductName= 49 | ProductVersion=1.0.0.0 50 | AutoIncBuildNr=0 51 | SyncProduct=1 52 | 53 | [Unit1] 54 | FileName=main.c 55 | CompileCpp=0 56 | Folder=Filter_bode 57 | Compile=1 58 | Link=1 59 | Priority=1000 60 | OverrideBuildCmd=0 61 | BuildCmd= 62 | 63 | [Unit2] 64 | FileName=main.h 65 | CompileCpp=0 66 | Folder=Filter_bode 67 | Compile=1 68 | Link=1 69 | Priority=1000 70 | OverrideBuildCmd=0 71 | BuildCmd= 72 | 73 | [Unit3] 74 | FileName=main_types.h 75 | CompileCpp=0 76 | Folder=Filter_bode 77 | Compile=1 78 | Link=1 79 | Priority=1000 80 | OverrideBuildCmd=0 81 | BuildCmd= 82 | 83 | [Unit4] 84 | FileName=rtwtypes.h 85 | CompileCpp=0 86 | Folder=Filter_bode 87 | Compile=1 88 | Link=1 89 | Priority=1000 90 | OverrideBuildCmd=0 91 | BuildCmd= 92 | 93 | [Unit5] 94 | FileName=rt_nonfinite.c 95 | CompileCpp=0 96 | Folder=Filter_bode 97 | Compile=1 98 | Link=1 99 | Priority=1000 100 | OverrideBuildCmd=0 101 | BuildCmd= 102 | 103 | [Unit6] 104 | FileName=rt_nonfinite.h 105 | CompileCpp=0 106 | Folder=Filter_bode 107 | Compile=1 108 | Link=1 109 | Priority=1000 110 | OverrideBuildCmd=0 111 | BuildCmd= 112 | 113 | [Unit7] 114 | FileName=rtGetInf.c 115 | CompileCpp=0 116 | Folder=Filter_bode 117 | Compile=1 118 | Link=1 119 | Priority=1000 120 | OverrideBuildCmd=0 121 | BuildCmd= 122 | 123 | [Unit8] 124 | FileName=rtGetInf.h 125 | CompileCpp=0 126 | Folder=Filter_bode 127 | Compile=1 128 | Link=1 129 | Priority=1000 130 | OverrideBuildCmd=0 131 | BuildCmd= 132 | 133 | [Unit9] 134 | FileName=rtGetNaN.c 135 | CompileCpp=0 136 | Folder=Filter_bode 137 | Compile=1 138 | Link=1 139 | Priority=1000 140 | OverrideBuildCmd=0 141 | BuildCmd= 142 | 143 | [Unit10] 144 | FileName=rtGetNaN.h 145 | CompileCpp=0 146 | Folder=Filter_bode 147 | Compile=1 148 | Link=1 149 | Priority=1000 150 | OverrideBuildCmd=0 151 | BuildCmd= 152 | 153 | [Unit11] 154 | FileName=rtwtypes.h 155 | CompileCpp=0 156 | Folder=Filter_bode 157 | Compile=1 158 | Link=1 159 | Priority=1000 160 | OverrideBuildCmd=0 161 | BuildCmd= 162 | 163 | -------------------------------------------------------------------------------- /C_project/C_DISLIN/Dev-Cpp/Filter_Design.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/C_DISLIN/Dev-Cpp/Filter_Design.exe -------------------------------------------------------------------------------- /C_project/C_DISLIN/Dev-Cpp/Parse_files.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Parse_files 3 | % Automatically modify the generated C and header files. 4 | % 5 | % Copyright 2024 The MathWorks, Inc. 6 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7 | 8 | %% Parsing of the main.h file 9 | clear variables; close all; clc; 10 | disp('Starting the parsing of the header file...'); 11 | % Constants declarations 12 | % Text files containing HMM definitions 13 | FILE_READ = '.\main_original.h'; 14 | FILE_WRITE = '.\main.h'; 15 | % Key words to recognize in the generated files 16 | KEY_TAGS = {'main(void)' 'main_initialize' 'main_terminate' 'File trailer'}; 17 | % Text to add at the end of the file 18 | LINE_FEED = newline; 19 | DIRECTIVES = {'/* Constants definition */' 20 | '#define NB_SAMPLES 100000' 21 | '#define FREQ_STEP 10' 22 | '#define Y_AXS_STEP 20' 23 | '#define ERROR_TYPE 1' 24 | '#define ERROR_ORDER 2' 25 | '/* Macros definition */' 26 | '#define min(a,b) (a<=b?a:b)' 27 | '#define max(a,b) (a>=b?a:b)' 28 | }; 29 | 30 | % Backup of the original generated file 31 | copyfile(FILE_WRITE,FILE_READ); 32 | 33 | % Open text files and get their handler 34 | file_read_ID = fopen(FILE_READ,'r'); 35 | file_write_ID = fopen(FILE_WRITE,'wt'); 36 | 37 | % Read all lines of the text file separately 38 | while(1) 39 | % Read the current line 40 | line_data = fgets(file_read_ID); 41 | % Look for any tag in the current line 42 | tags_present = cellfun(@(s) contains(line_data,s),KEY_TAGS); 43 | if (any(tags_present)) 44 | % Get the index of the identified tag 45 | tag_idx = find(tags_present); 46 | % Retrieve needed data based on tags identification 47 | switch (tag_idx) 48 | case {1} 49 | fprintf(file_write_ID,'%s',line_data(1:end-1)); 50 | % Write pre-compilation directives needed for the C code 51 | for i=1:length(DIRECTIVES) 52 | fprintf(file_write_ID,'%s',[LINE_FEED DIRECTIVES{i,1}]); 53 | end 54 | fprintf(file_write_ID,'%s',LINE_FEED); 55 | case {2,3} 56 | line_data = fgets(file_read_ID); 57 | fprintf(file_write_ID,'%s',''); 58 | case {4} 59 | % Copy the trailer comment 60 | fprintf(file_write_ID,'%s',line_data(1:end-1)); 61 | line_data = fgets(file_read_ID); 62 | fprintf(file_write_ID,'%s',line_data(1:end-1)); 63 | otherwise 64 | disp('Tagging error in file'); 65 | end 66 | else 67 | fprintf(file_write_ID,'%s',line_data(1:end-1)); 68 | end 69 | 70 | % Leave the loop if the end of file has been reached 71 | if (feof(file_read_ID)) 72 | break; 73 | end 74 | end 75 | % Close text files 76 | fclose(file_read_ID); 77 | fclose(file_write_ID); 78 | disp('Parsing of the header file done.'); 79 | 80 | %% Parsing of the main.c file 81 | clear variables; close all; 82 | disp('Starting the parsing of the C file...'); 83 | % Constants declarations 84 | % Text files containing HMM definitions 85 | FILE_READ = '.\main_original.c'; 86 | FILE_WRITE = '.\main.c'; 87 | % Key words to recognize in the generated files 88 | KEY_TAGS = {'100000' '99999' '99998'}; 89 | % Text to add at the beginning of the file 90 | LINE_FEED = newline; 91 | INCLUDES = {'#include "dislin.h" /* Added of the graphical library */' 92 | '#include ' 93 | '#include '}; 94 | 95 | % Text to add at the end of the file 96 | file_ID = fopen('.\min_and_max.txt','r'); 97 | k = 0; 98 | while(1) 99 | k = k+1; 100 | min_and_max{k,1} = fgets(file_ID); %#ok 101 | if (feof(file_ID)) 102 | break; 103 | end 104 | end 105 | file_ID = fopen('.\main.txt','r'); 106 | k = 0; 107 | while(1) 108 | k = k+1; 109 | main{k,1} = fgets(file_ID); %#ok 110 | if (feof(file_ID)) 111 | break; 112 | end 113 | end 114 | 115 | % Backup of the original generated file 116 | copyfile(FILE_WRITE,FILE_READ); 117 | % Open text files and get their handler 118 | file_read_ID = fopen(FILE_READ,'r'); 119 | file_write_ID = fopen(FILE_WRITE,'wt'); 120 | 121 | % Read all lines of the text file separately 122 | counter = 0; 123 | do_not_copy = 0; 124 | while(1) 125 | % Read the current line 126 | line_data = fgets(file_read_ID); 127 | % Look for any tag in the current line 128 | tags_present = cellfun(@(s) contains(line_data,s),KEY_TAGS); 129 | if any(tags_present) 130 | % Add of the pre-defined directives for constant values 131 | line_data = regexprep(line_data,KEY_TAGS(1),'NB_SAMPLES'); 132 | line_data = regexprep(line_data,KEY_TAGS(2),'NB_SAMPLES-1'); 133 | line_data = regexprep(line_data,KEY_TAGS(end),'NB_SAMPLES-2'); 134 | elseif regexp(line_data,'') 135 | % Write includes needed for the main C file 136 | for i=1:length(INCLUDES) 137 | fprintf(file_write_ID,'%s',[INCLUDES{i,1} LINE_FEED]); 138 | end 139 | elseif regexp(line_data,'Function: main\(\)') 140 | % Added of the min_and_max function 141 | for i=1:length(min_and_max) 142 | line_to_write = min_and_max{i,1}; 143 | fprintf(file_write_ID,'%s',line_to_write(1:end-1)); 144 | end 145 | elseif regexp(line_data,'int main\(void\)') 146 | % Added of the main function with the graphical interface 147 | for i=1:length(main) 148 | line_to_write = main{i,1}; 149 | fprintf(file_write_ID,'%s',line_to_write(1:end-1)); 150 | end 151 | do_not_copy = 1; 152 | elseif regexp(line_data,'* Arguments : void') 153 | if (counter > 0) 154 | for i=1:17 155 | line_data = fgets(file_read_ID); 156 | fprintf(file_write_ID,'%s',''); 157 | end 158 | end 159 | counter = counter+1; 160 | end 161 | 162 | if (do_not_copy == 0) 163 | fprintf(file_write_ID,'%s',line_data(1:end-1)); 164 | end 165 | 166 | % Leave the loop if the end of file has been reached 167 | if feof(file_read_ID) 168 | break; 169 | end 170 | end 171 | 172 | % Close text files 173 | fclose(file_read_ID); 174 | fclose(file_write_ID); 175 | disp('Parsing of the C file done.'); 176 | -------------------------------------------------------------------------------- /C_project/C_DISLIN/Dev-Cpp/main.h: -------------------------------------------------------------------------------- 1 | /* * File: main.h * * MATLAB Coder version : 24.1 * C/C++ source code generated on : 10-Jul-2024 11:15:53 */ #ifndef MAIN_H #define MAIN_H /* Include Files */ #include "rtwtypes.h" #include #include #ifdef __cplusplus extern "C" { #endif /* Function Declarations */ extern int main(void); 2 | /* Constants definition */ 3 | #define NB_SAMPLES 100000 4 | #define FREQ_STEP 10 5 | #define Y_AXS_STEP 20 6 | #define ERROR_TYPE 1 7 | #define ERROR_ORDER 2 8 | /* Macros definition */ 9 | #define min(a,b) (a<=b?a:b) 10 | #define max(a,b) (a>=b?a:b) 11 | #ifdef __cplusplus } #endif #endif /* * File trailer for main.h * * [EOF] */ -------------------------------------------------------------------------------- /C_project/C_DISLIN/Dev-Cpp/main.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/C_DISLIN/Dev-Cpp/main.txt -------------------------------------------------------------------------------- /C_project/C_DISLIN/Dev-Cpp/main_original.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File: main.h 3 | * 4 | * MATLAB Coder version : 24.1 5 | * C/C++ source code generated on : 10-Jul-2024 11:15:53 6 | */ 7 | 8 | #ifndef MAIN_H 9 | #define MAIN_H 10 | 11 | /* Include Files */ 12 | #include "rtwtypes.h" 13 | #include 14 | #include 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | /* Function Declarations */ 21 | extern int main(void); 22 | 23 | extern void main_initialize(void); 24 | 25 | #ifdef __cplusplus 26 | } 27 | #endif 28 | 29 | #endif 30 | /* 31 | * File trailer for main.h 32 | * 33 | * [EOF] 34 | */ 35 | -------------------------------------------------------------------------------- /C_project/C_DISLIN/Dev-Cpp/main_types.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File: main_types.h 3 | * 4 | * MATLAB Coder version : 4.0 5 | * C/C++ source code generated on : 30-Apr-2018 13:53:32 6 | */ 7 | 8 | #ifndef MAIN_TYPES_H 9 | #define MAIN_TYPES_H 10 | 11 | /* Include Files */ 12 | #include "rtwtypes.h" 13 | #endif 14 | 15 | /* 16 | * File trailer for main_types.h 17 | * 18 | * [EOF] 19 | */ 20 | -------------------------------------------------------------------------------- /C_project/C_DISLIN/Dev-Cpp/min_and_max.txt: -------------------------------------------------------------------------------- 1 | * Function: min_and_max() 2 | * Goal : Set the min and max values of axes for the graphical display 3 | * 4 | * IN : - data[NB_SAMPLES]: data to display 5 | * - min_val : minimal possible value 6 | * - max_val : maximal possible value 7 | * IN/OUT : - *data_min: min value to display 8 | * - *data_max: max value to display 9 | * OUT : - 10 | * 11 | * Copyright 2018 The MathWorks, Inc. 12 | * %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 13 | */ 14 | static void min_and_max(double *data_min, double *data_max, 15 | double min_val, double max_val, double data[NB_SAMPLES]) 16 | { 17 | double temp_min, temp_max; 18 | int i, min_idx, max_idx; 19 | 20 | /* Looking for the boundaries */ 21 | for (i = 0; i < NB_SAMPLES-1; i++) { 22 | temp_min = min(data[i],data[i+1]); 23 | temp_max = max(data[i],data[i+1]); 24 | if (temp_min < *data_min) { 25 | *data_min = temp_min; 26 | min_idx = i; 27 | } 28 | if (temp_max > *data_max) { 29 | *data_max = temp_max; 30 | max_idx = i; 31 | } 32 | } 33 | 34 | /* Round up of the boundaries */ 35 | *data_min = ceil(*data_min-1); 36 | *data_max = ceil(*data_max+1); 37 | if (fmod(*data_min,10) != 0){ 38 | /* Set the min boundary to have no division remainder for a divider of 10 */ 39 | *data_min = *data_min - Y_AXS_STEP+1; 40 | } 41 | 42 | /* Check infinite values and set min/max limits if needed */ 43 | if (*data_min < -DBL_MAX) { 44 | *data_min = min_val; 45 | data[min_idx+1] = min_val; /* Saturate to avoid plotting out of scope */ 46 | } 47 | if (*data_max > DBL_MAX) { 48 | *data_max = max_val; 49 | data[max_idx+1] = max_val; /* Saturate to avoid plotting out of scope */ 50 | } 51 | /* For debug purposes only */ 52 | //printf("min = %lf, max = %lf\n", *data_min,*data_max); 53 | } 54 | 55 | /* 56 | * %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 57 | -------------------------------------------------------------------------------- /C_project/C_DISLIN/Dev-Cpp/rtwtypes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File: rtwtypes.h 3 | * 4 | * MATLAB Coder version : 4.0 5 | * C/C++ source code generated on : 30-Apr-2018 13:53:32 6 | */ 7 | 8 | #ifndef RTWTYPES_H 9 | #define RTWTYPES_H 10 | 11 | /*=======================================================================* 12 | * Target hardware information 13 | * Device type: Intel->x86-64 (Windows64) 14 | * Number of bits: char: 8 short: 16 int: 32 15 | * long: 32 16 | * native word size: 64 17 | * Byte ordering: LittleEndian 18 | * Signed integer division rounds to: Zero 19 | * Shift right on a signed integer as arithmetic shift: on 20 | *=======================================================================*/ 21 | 22 | /*=======================================================================* 23 | * Fixed width word size data types: * 24 | * int8_T, int16_T, int32_T - signed 8, 16, or 32 bit integers * 25 | * uint8_T, uint16_T, uint32_T - unsigned 8, 16, or 32 bit integers * 26 | * real32_T, real64_T - 32 and 64 bit floating point numbers * 27 | *=======================================================================*/ 28 | typedef signed char int8_T; 29 | typedef unsigned char uint8_T; 30 | typedef short int16_T; 31 | typedef unsigned short uint16_T; 32 | typedef int int32_T; 33 | typedef unsigned int uint32_T; 34 | typedef float real32_T; 35 | typedef double real64_T; 36 | 37 | /*===========================================================================* 38 | * Generic type definitions: real_T, time_T, boolean_T, int_T, uint_T, * 39 | * ulong_T, char_T and byte_T. * 40 | *===========================================================================*/ 41 | typedef double real_T; 42 | typedef double time_T; 43 | typedef unsigned char boolean_T; 44 | typedef int int_T; 45 | typedef unsigned int uint_T; 46 | typedef unsigned long ulong_T; 47 | typedef char char_T; 48 | typedef char_T byte_T; 49 | 50 | /*===========================================================================* 51 | * Complex number type definitions * 52 | *===========================================================================*/ 53 | #define CREAL_T 54 | 55 | typedef struct { 56 | real32_T re; 57 | real32_T im; 58 | } creal32_T; 59 | 60 | typedef struct { 61 | real64_T re; 62 | real64_T im; 63 | } creal64_T; 64 | 65 | typedef struct { 66 | real_T re; 67 | real_T im; 68 | } creal_T; 69 | 70 | typedef struct { 71 | int8_T re; 72 | int8_T im; 73 | } cint8_T; 74 | 75 | typedef struct { 76 | uint8_T re; 77 | uint8_T im; 78 | } cuint8_T; 79 | 80 | typedef struct { 81 | int16_T re; 82 | int16_T im; 83 | } cint16_T; 84 | 85 | typedef struct { 86 | uint16_T re; 87 | uint16_T im; 88 | } cuint16_T; 89 | 90 | typedef struct { 91 | int32_T re; 92 | int32_T im; 93 | } cint32_T; 94 | 95 | typedef struct { 96 | uint32_T re; 97 | uint32_T im; 98 | } cuint32_T; 99 | 100 | /*=======================================================================* 101 | * Min and Max: * 102 | * int8_T, int16_T, int32_T - signed 8, 16, or 32 bit integers * 103 | * uint8_T, uint16_T, uint32_T - unsigned 8, 16, or 32 bit integers * 104 | *=======================================================================*/ 105 | #define MAX_int8_T ((int8_T)(127)) 106 | #define MIN_int8_T ((int8_T)(-128)) 107 | #define MAX_uint8_T ((uint8_T)(255)) 108 | #define MIN_uint8_T ((uint8_T)(0)) 109 | #define MAX_int16_T ((int16_T)(32767)) 110 | #define MIN_int16_T ((int16_T)(-32768)) 111 | #define MAX_uint16_T ((uint16_T)(65535)) 112 | #define MIN_uint16_T ((uint16_T)(0)) 113 | #define MAX_int32_T ((int32_T)(2147483647)) 114 | #define MIN_int32_T ((int32_T)(-2147483647-1)) 115 | #define MAX_uint32_T ((uint32_T)(0xFFFFFFFFU)) 116 | #define MIN_uint32_T ((uint32_T)(0)) 117 | 118 | /* Logical type definitions */ 119 | #if !defined(__cplusplus) && !defined(__true_false_are_keywords) && !defined(__bool_true_false_are_defined) 120 | # ifndef false 121 | # define false (0U) 122 | # endif 123 | 124 | # ifndef true 125 | # define true (1U) 126 | # endif 127 | #endif 128 | 129 | /* 130 | * Maximum length of a MATLAB identifier (function/variable) 131 | * including the null-termination character. Referenced by 132 | * rt_logging.c and rt_matrx.c. 133 | */ 134 | #define TMW_NAME_LENGTH_MAX 64 135 | #endif 136 | 137 | /* 138 | * File trailer for rtwtypes.h 139 | * 140 | * [EOF] 141 | */ 142 | -------------------------------------------------------------------------------- /C_project/C_DISLIN/VS2022/.vs/Filter_Design/v17/.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/C_DISLIN/VS2022/.vs/Filter_Design/v17/.suo -------------------------------------------------------------------------------- /C_project/C_DISLIN/VS2022/Filter_Design.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Filter_Design", "Filter_Design.vcxproj", "{F7429098-CAD4-4B3A-B0C9-3CCD069945EF}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Debug|x64 = Debug|x64 10 | Release|Win32 = Release|Win32 11 | Release|x64 = Release|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {F7429098-CAD4-4B3A-B0C9-3CCD069945EF}.Debug|Win32.ActiveCfg = Debug|Win32 15 | {F7429098-CAD4-4B3A-B0C9-3CCD069945EF}.Debug|Win32.Build.0 = Debug|Win32 16 | {F7429098-CAD4-4B3A-B0C9-3CCD069945EF}.Debug|x64.ActiveCfg = Debug|x64 17 | {F7429098-CAD4-4B3A-B0C9-3CCD069945EF}.Debug|x64.Build.0 = Debug|x64 18 | {F7429098-CAD4-4B3A-B0C9-3CCD069945EF}.Release|Win32.ActiveCfg = Release|Win32 19 | {F7429098-CAD4-4B3A-B0C9-3CCD069945EF}.Release|Win32.Build.0 = Release|Win32 20 | {F7429098-CAD4-4B3A-B0C9-3CCD069945EF}.Release|x64.ActiveCfg = Release|x64 21 | {F7429098-CAD4-4B3A-B0C9-3CCD069945EF}.Release|x64.Build.0 = Release|x64 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | EndGlobal 27 | -------------------------------------------------------------------------------- /C_project/C_DISLIN/VS2022/Filter_Design.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | Win32 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | {F7429098-CAD4-4B3A-B0C9-3CCD069945EF} 23 | Win32Proj 24 | Filter_Design 25 | 10.0 26 | 27 | 28 | 29 | Application 30 | true 31 | v143 32 | Unicode 33 | 34 | 35 | Application 36 | true 37 | v143 38 | Unicode 39 | 40 | 41 | Application 42 | false 43 | v143 44 | true 45 | Unicode 46 | 47 | 48 | Application 49 | false 50 | v143 51 | true 52 | Unicode 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | true 72 | 73 | 74 | true 75 | 76 | 77 | false 78 | 79 | 80 | false 81 | 82 | 83 | 84 | 85 | 86 | Level3 87 | Disabled 88 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 89 | c:\dislin 90 | MultiThreaded 91 | 92 | 93 | Console 94 | true 95 | kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;c:\dislin\disvc.lib;%(AdditionalDependencies) 96 | false 97 | 98 | 99 | 100 | 101 | NotUsing 102 | Level3 103 | Disabled 104 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 105 | c:\dislin\real64 106 | MultiThreaded 107 | 108 | 109 | Console 110 | true 111 | kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;c:\dislin\disvc_d.lib;%(AdditionalDependencies) 112 | false 113 | 114 | 115 | 116 | 117 | Level3 118 | 119 | 120 | MaxSpeed 121 | true 122 | true 123 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 124 | 125 | 126 | Console 127 | true 128 | true 129 | true 130 | 131 | 132 | 133 | 134 | Level3 135 | 136 | 137 | MaxSpeed 138 | true 139 | true 140 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 141 | c:\dislin\real64 142 | MultiThreaded 143 | 144 | 145 | Console 146 | true 147 | true 148 | true 149 | kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;c:\dislin\disvc_d.lib;%(AdditionalDependencies) 150 | false 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | -------------------------------------------------------------------------------- /C_project/C_DISLIN/VS2022/Filter_Design.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | 29 | 30 | Source Files 31 | 32 | 33 | -------------------------------------------------------------------------------- /C_project/C_DISLIN/VS2022/Filter_Design.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /C_project/C_DISLIN/VS2022/Parse_files.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Parse_files 3 | % Automatically modify the generated C and header files. 4 | % 5 | % Copyright 2024 The MathWorks, Inc. 6 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7 | 8 | %% Parsing of the main.h file 9 | clear variables; close all; clc; 10 | disp('Starting the parsing of the header file...'); 11 | % Constants declarations 12 | % Text files containing HMM definitions 13 | FILE_READ = '.\main_original.h'; 14 | FILE_WRITE = '.\main.h'; 15 | % Key words to recognize in the generated files 16 | KEY_TAGS = {'main(void)' 'main_initialize' 'main_terminate' 'File trailer'}; 17 | % Text to add at the end of the file 18 | LINE_FEED = newline; 19 | DIRECTIVES = {'/* Constants definition */' 20 | '#define NB_SAMPLES 100000' 21 | '#define FREQ_STEP 10' 22 | '#define Y_AXS_STEP 20' 23 | '#define ERROR_TYPE 1' 24 | '#define ERROR_ORDER 2' 25 | '/* Macros definition */' 26 | '#define min_data(a,b) (a<=b?a:b)' 27 | '#define max_data(a,b) (a>=b?a:b)' 28 | }; 29 | 30 | % Backup of the original generated file 31 | copyfile(FILE_WRITE,FILE_READ); 32 | 33 | % Open text files and get their handler 34 | file_read_ID = fopen(FILE_READ,'r'); 35 | file_write_ID = fopen(FILE_WRITE,'wt'); 36 | 37 | % Read all lines of the text file separately 38 | while(1) 39 | % Read the current line 40 | line_data = fgets(file_read_ID); 41 | % Look for any tag in the current line 42 | tags_present = cellfun(@(s) contains(line_data,s),KEY_TAGS); 43 | if any(tags_present) 44 | % Get the index of the identified tag 45 | tag_idx = find(tags_present); 46 | % Retrieve needed data based on tags identification 47 | switch (tag_idx) 48 | case {1} 49 | fprintf(file_write_ID,'%s',line_data(1:end-1)); 50 | % Write pre-compilation directives needed for the C code 51 | for i=1:length(DIRECTIVES) 52 | fprintf(file_write_ID,'%s',[LINE_FEED DIRECTIVES{i,1}]); 53 | end 54 | fprintf(file_write_ID,'%s',LINE_FEED); 55 | case {2,3} 56 | line_data = fgets(file_read_ID); 57 | fprintf(file_write_ID,'%s',''); 58 | case {4} 59 | % Copy the trailer comment 60 | fprintf(file_write_ID,'%s',line_data(1:end-1)); 61 | line_data = fgets(file_read_ID); 62 | fprintf(file_write_ID,'%s',line_data(1:end-1)); 63 | otherwise 64 | disp('Tagging error in file'); 65 | end 66 | else 67 | fprintf(file_write_ID,'%s',line_data(1:end-1)); 68 | end 69 | 70 | % Leave the loop if the end of file has been reached 71 | if (feof(file_read_ID)) 72 | break; 73 | end 74 | end 75 | % Close text files 76 | fclose(file_read_ID); 77 | fclose(file_write_ID); 78 | disp('Parsing of the header file done.'); 79 | 80 | %% Parsing of the main.c file 81 | clear variables; close all; 82 | disp('Starting the parsing of the C file...'); 83 | % Constants declarations 84 | % Text files containing HMM definitions 85 | FILE_READ = '.\main_original.c'; 86 | FILE_WRITE = '.\main.c'; 87 | % Key words to recognize in the generated files 88 | KEY_TAGS = {'100000' '99999' '99998'}; 89 | % Text to add at the beginning of the file 90 | LINE_FEED = newline; 91 | INCLUDES = {'#include "dislin.h" /* Added of the graphical library */' 92 | '#include ' 93 | '#include '}; 94 | 95 | % Text to add at the end of the file 96 | file_ID = fopen('.\min_and_max.txt','r'); 97 | k = 0; 98 | while(1) 99 | k = k+1; 100 | min_and_max{k,1} = fgets(file_ID); %#ok 101 | if (feof(file_ID)) 102 | break; 103 | end 104 | end 105 | file_ID = fopen('.\main.txt','r'); 106 | k = 0; 107 | while(1) 108 | k = k+1; 109 | main{k,1} = fgets(file_ID); %#ok 110 | if (feof(file_ID)) 111 | break; 112 | end 113 | end 114 | 115 | % Backup of the original generated file 116 | copyfile(FILE_WRITE,FILE_READ); 117 | % Open text files and get their handler 118 | file_read_ID = fopen(FILE_READ,'r'); 119 | file_write_ID = fopen(FILE_WRITE,'wt'); 120 | 121 | % Read all lines of the text file separately 122 | counter = 0; 123 | do_not_copy = 0; 124 | while(1) 125 | % Read the current line 126 | line_data = fgets(file_read_ID); 127 | % Look for any tag in the current line 128 | tags_present = cellfun(@(s) contains(line_data,s),KEY_TAGS); 129 | if any(tags_present) 130 | % Add of the pre-defined directives for constant values 131 | line_data = regexprep(line_data,KEY_TAGS(1),'NB_SAMPLES'); 132 | line_data = regexprep(line_data,KEY_TAGS(2),'NB_SAMPLES-1'); 133 | line_data = regexprep(line_data,KEY_TAGS(end),'NB_SAMPLES-2'); 134 | elseif regexp(line_data,'') 135 | % Write includes needed for the main C file 136 | for i=1:length(INCLUDES) 137 | fprintf(file_write_ID,'%s',[INCLUDES{i,1} LINE_FEED]); 138 | end 139 | elseif regexp(line_data,'Function: main\(\)') 140 | % Added of the min_and_max function 141 | for i=1:length(min_and_max) 142 | line_to_write = min_and_max{i,1}; 143 | fprintf(file_write_ID,'%s',line_to_write(1:end-1)); 144 | end 145 | elseif regexp(line_data,'int main\(void\)') 146 | % Added of the main function with the graphical interface 147 | for i=1:length(main) 148 | line_to_write = main{i,1}; 149 | fprintf(file_write_ID,'%s',line_to_write(1:end-1)); 150 | end 151 | do_not_copy = 1; 152 | elseif regexp(line_data,'* Arguments : void') 153 | if (counter > 0) 154 | for i=1:17 155 | line_data = fgets(file_read_ID); 156 | fprintf(file_write_ID,'%s',''); 157 | end 158 | end 159 | counter = counter+1; 160 | end 161 | 162 | if (do_not_copy == 0) 163 | fprintf(file_write_ID,'%s',line_data(1:end-1)); 164 | end 165 | 166 | % Leave the loop if the end of file has been reached 167 | if feof(file_read_ID) 168 | break; 169 | end 170 | end 171 | 172 | % Close text files 173 | fclose(file_read_ID); 174 | fclose(file_write_ID); 175 | disp('Parsing of the C file done.'); 176 | -------------------------------------------------------------------------------- /C_project/C_DISLIN/VS2022/main.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File: main.h 3 | * 4 | * MATLAB Coder version : 24.1 5 | * C/C++ source code generated on : 09-Jul-2024 17:03:17 6 | */ 7 | 8 | #ifndef MAIN_H 9 | #define MAIN_H 10 | 11 | /* Include Files */ 12 | #include "rtwtypes.h" 13 | #include 14 | #include 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | /* Function Declarations */ 21 | extern int main(void); 22 | 23 | /* Constants definition */ 24 | #define NB_SAMPLES 100000 25 | #define FREQ_STEP 10 26 | #define Y_AXS_STEP 20 27 | #define ERROR_TYPE 1 28 | #define ERROR_ORDER 2 29 | /* Macros definition */ 30 | #define min_data(a,b) (a<=b?a:b) 31 | #define max_data(a,b) (a>=b?a:b) 32 | 33 | #ifdef __cplusplus 34 | } 35 | #endif 36 | 37 | #endif 38 | /* 39 | * File trailer for main.h 40 | * 41 | * [EOF] 42 | */ 43 | -------------------------------------------------------------------------------- /C_project/C_DISLIN/VS2022/main.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/C_DISLIN/VS2022/main.txt -------------------------------------------------------------------------------- /C_project/C_DISLIN/VS2022/main_original.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File: main.h 3 | * 4 | * MATLAB Coder version : 24.1 5 | * C/C++ source code generated on : 09-Jul-2024 17:03:17 6 | */ 7 | 8 | #ifndef MAIN_H 9 | #define MAIN_H 10 | 11 | /* Include Files */ 12 | #include "rtwtypes.h" 13 | #include 14 | #include 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | /* Function Declarations */ 21 | extern int main(void); 22 | 23 | extern void main_initialize(void); 24 | 25 | #ifdef __cplusplus 26 | } 27 | #endif 28 | 29 | #endif 30 | /* 31 | * File trailer for main.h 32 | * 33 | * [EOF] 34 | */ 35 | -------------------------------------------------------------------------------- /C_project/C_DISLIN/VS2022/min_and_max.txt: -------------------------------------------------------------------------------- 1 | * Function: min_and_max() 2 | * Goal : Set the min and max values of axes for the graphical display 3 | * 4 | * IN : - data[NB_SAMPLES]: data to display 5 | * - min_val : minimal possible value 6 | * - max_val : maximal possible value 7 | * IN/OUT : - *data_min: min value to display 8 | * - *data_max: max value to display 9 | * OUT : - 10 | * 11 | * Copyright 2018 The MathWorks, Inc. 12 | * %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 13 | */ 14 | static void min_and_max(double *data_min, double *data_max, 15 | double min_val, double max_val, double data[NB_SAMPLES]) 16 | { 17 | double temp_min, temp_max; 18 | int i, min_idx, max_idx; 19 | 20 | /* Looking for the boundaries */ 21 | for (i = 0; i < NB_SAMPLES-1; i++) { 22 | temp_min = min_data(data[i],data[i+1]); 23 | temp_max = max_data(data[i],data[i+1]); 24 | if (temp_min < *data_min) { 25 | *data_min = temp_min; 26 | min_idx = i; 27 | } 28 | if (temp_max > *data_max) { 29 | *data_max = temp_max; 30 | max_idx = i; 31 | } 32 | } 33 | 34 | /* Round up of the boundaries */ 35 | *data_min = ceil(*data_min-1); 36 | *data_max = ceil(*data_max+1); 37 | if (fmod(*data_min,10) != 0){ 38 | /* Set the min boundary to have no division remainder for a divider of 10 */ 39 | *data_min = *data_min - Y_AXS_STEP+1; 40 | } 41 | 42 | /* Check infinite values and set min/max limits if needed */ 43 | if (*data_min < -DBL_MAX) { 44 | *data_min = min_val; 45 | data[min_idx+1] = min_val; /* Saturate to avoid plotting out of scope */ 46 | } 47 | if (*data_max > DBL_MAX) { 48 | *data_max = max_val; 49 | data[max_idx+1] = max_val; /* Saturate to avoid plotting out of scope */ 50 | } 51 | /* For debug purposes only */ 52 | //printf("min = %lf, max = %lf\n", *data_min,*data_max); 53 | } 54 | 55 | /* 56 | * %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 57 | -------------------------------------------------------------------------------- /C_project/C_DISLIN/VS2022/rtwtypes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File: rtwtypes.h 3 | * 4 | * MATLAB Coder version : 24.1 5 | * C/C++ source code generated on : 09-Jul-2024 17:03:17 6 | */ 7 | 8 | #ifndef RTWTYPES_H 9 | #define RTWTYPES_H 10 | 11 | /*=======================================================================* 12 | * Fixed width word size data types: * 13 | * int64_T - signed 64 bit integers * 14 | * uint64_T - unsigned 64 bit integers * 15 | *=======================================================================*/ 16 | 17 | #if defined(__APPLE__) 18 | #ifndef INT64_T 19 | #define INT64_T long 20 | #define FMT64 "l" 21 | #if defined(__LP64__) && !defined(INT_TYPE_64_IS_LONG) 22 | #define INT_TYPE_64_IS_LONG 23 | #endif 24 | #endif 25 | #endif 26 | 27 | #if defined(__APPLE__) 28 | #ifndef UINT64_T 29 | #define UINT64_T unsigned long 30 | #define FMT64 "l" 31 | #if defined(__LP64__) && !defined(INT_TYPE_64_IS_LONG) 32 | #define INT_TYPE_64_IS_LONG 33 | #endif 34 | #endif 35 | #endif 36 | 37 | /* Include Files */ 38 | #include "tmwtypes.h" 39 | 40 | #endif 41 | /* 42 | * File trailer for rtwtypes.h 43 | * 44 | * [EOF] 45 | */ 46 | -------------------------------------------------------------------------------- /C_project/C_DISLIN/VS2022/tmwtypes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1984-2018 The MathWorks, Inc. 3 | */ 4 | 5 | #if defined(_MSC_VER) 6 | # pragma once 7 | #endif 8 | #if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 3)) 9 | # pragma once 10 | #endif 11 | 12 | #ifndef tmwtypes_h 13 | #define tmwtypes_h 14 | 15 | #ifndef __TMWTYPES__ 16 | #define __TMWTYPES__ 17 | /* 18 | * File : tmwtypes.h 19 | * Abstract: 20 | * Data types for use with MATLAB/SIMULINK and the Real-Time Workshop. 21 | * 22 | * When compiling stand-alone model code, data types can be overridden 23 | * via compiler switches. 24 | * 25 | * Define NO_FLOATS to eliminate reference to real_T, etc. 26 | */ 27 | 28 | #ifdef MW_LIBTOOLING 29 | #include "mwstdint.h" 30 | #endif 31 | 32 | #include 33 | 34 | /* __STDC_VERSION__ version check below means "check for a C99 compiler". 35 | 36 | Visual Studio (checked on versions 2015 and 2017) does 37 | not define __STDC_VERSION__, however it has stdbool.h available, 38 | thus a separate check for _MSC_VER below. 39 | */ 40 | #if defined(__APPLE_CC__) \ 41 | || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) \ 42 | || (defined(_MSC_VER) && (_MSC_VER >= 1900)) 43 | #ifndef tmwtypes_do_not_include_stdbool 44 | #include 45 | #endif 46 | #endif 47 | 48 | #define LOGICAL_IS_A_TYPE 49 | #define SPARSE_GENERALIZATION 50 | 51 | #ifdef NO_FLOATS 52 | # define double double_not_allowed 53 | # define float float_not_allowed 54 | #endif /*NO_FLOATS*/ 55 | 56 | #ifndef NO_FLOATS 57 | 58 | #ifndef __MWERKS__ 59 | # ifdef __STDC__ 60 | # include 61 | # else 62 | # ifndef FLT_MANT_DIG 63 | # define FLT_MANT_DIG 24 64 | # endif 65 | # ifndef DBL_MANT_DIG 66 | # define DBL_MANT_DIG 53 67 | # endif 68 | # endif 69 | #endif 70 | 71 | #endif /*NO_FLOATS*/ 72 | 73 | /* 74 | * The following data types cannot be overridden when building MEX files. 75 | */ 76 | #ifdef MATLAB_MEX_FILE 77 | # undef CHARACTER_T 78 | # undef INTEGER_T 79 | # undef BOOLEAN_T 80 | # undef REAL_T 81 | # undef TIME_T 82 | #endif 83 | 84 | /* 85 | * The uchar_T, ushort_T and ulong_T types are needed for compilers which do 86 | * not allow defines to be specified, at the command line, with spaces in them. 87 | */ 88 | 89 | typedef unsigned char uchar_T; 90 | typedef unsigned short ushort_T; 91 | typedef unsigned long ulong_T; 92 | 93 | #if (defined(_MSC_VER) && _MSC_VER >= 1500) \ 94 | || defined(__x86_64__) || defined(__LP64__) \ 95 | || defined(__LCC64__) 96 | 97 | typedef unsigned long long ulonglong_T; 98 | #endif 99 | 100 | 101 | 102 | /*=======================================================================* 103 | * Fixed width word size data types: * 104 | * int8_T, int16_T, int32_T - signed 8, 16, or 32 bit integers * 105 | * uint8_T, uint16_T, uint32_T - unsigned 8, 16, or 32 bit integers * 106 | * real32_T, real64_T - 32 and 64 bit floating point numbers * 107 | *=======================================================================*/ 108 | 109 | /* When used with Real Time Workshop generated code, this 110 | * header file can be used with a variety of compilers. 111 | * 112 | * The compiler could be for an 8 bit embedded processor that 113 | * only had 8 bits per integer and 16 bits per long. 114 | * In that example, a 32 bit integer size is not even available. 115 | * This header file should be robust to that. 116 | * 117 | * For the case of an 8 bit processor, the preprocessor 118 | * may be limited to 16 bit math like its target. That limitation 119 | * would mean that 32 bit comparisons can't be done accurately. 120 | * To increase robustness to this, comparisons are done against 121 | * smaller values first. An inaccurate 32 bit comparison isn't 122 | * attempted if the 16 bit comparison has already succeeded. 123 | * 124 | * Limitations on preprocessor math can also be stricter than 125 | * for the target. There are known cases where a compiler 126 | * targeting processors with 64 bit longs can't do accurate 127 | * preprocessor comparisons on more than 32 bits. 128 | */ 129 | 130 | /* Determine the number of bits for int, long, short, and char. 131 | * If one fails to be determined, set the number of bits to -1 132 | */ 133 | 134 | #ifndef TMW_BITS_PER_INT 135 | # if INT_MAX == 0x7FL 136 | # define TMW_BITS_PER_INT 8 137 | # elif INT_MAX == 0x7FFFL 138 | # define TMW_BITS_PER_INT 16 139 | # elif INT_MAX == 0x7FFFFFFFL 140 | # define TMW_BITS_PER_INT 32 141 | # else 142 | # define TMW_BITS_PER_INT -1 143 | # endif 144 | #endif 145 | 146 | #ifndef TMW_BITS_PER_LONG 147 | # if LONG_MAX == 0x7FL 148 | # define TMW_BITS_PER_LONG 8 149 | # elif LONG_MAX == 0x7FFFL 150 | # define TMW_BITS_PER_LONG 16 151 | # elif LONG_MAX == 0x7FFFFFFFL 152 | # define TMW_BITS_PER_LONG 32 153 | # else 154 | # define TMW_BITS_PER_LONG -1 155 | # endif 156 | #endif 157 | 158 | #ifndef TMW_BITS_PER_SHRT 159 | # if SHRT_MAX == 0x7FL 160 | # define TMW_BITS_PER_SHRT 8 161 | # elif SHRT_MAX == 0x7FFFL 162 | # define TMW_BITS_PER_SHRT 16 163 | # elif SHRT_MAX == 0x7FFFFFFFL 164 | # define TMW_BITS_PER_SHRT 32 165 | # else 166 | # define TMW_BITS_PER_SHRT -1 167 | # endif 168 | #endif 169 | 170 | #ifndef TMW_BITS_PER_SCHAR 171 | # if SCHAR_MAX == 0x7FL 172 | # define TMW_BITS_PER_SCHAR 8 173 | # elif SCHAR_MAX == 0x7FFFL 174 | # define TMW_BITS_PER_SCHAR 16 175 | # elif SCHAR_MAX == 0x7FFFFFFFL 176 | # define TMW_BITS_PER_SCHAR 32 177 | # else 178 | # define TMW_BITS_PER_SCHAR -1 179 | # endif 180 | #endif 181 | 182 | #ifndef TMW_CHAR_SIGNED 183 | # if SCHAR_MAX == CHAR_MAX 184 | # define TMW_CHAR_SIGNED 1 185 | # else 186 | # define TMW_CHAR_SIGNED 0 187 | # endif 188 | #endif 189 | 190 | /* It is common for one or more of the integer types 191 | * to be the same size. For example, on many embedded 192 | * processors, both shorts and ints are 16 bits. On 193 | * processors used for workstations, it is quite common 194 | * for both int and long to be 32 bits. 195 | * When there is more than one choice for typdef'ing 196 | * a portable type like int16_T or uint32_T, in 197 | * concept, it should not matter which choice is made. 198 | * However, some style guides and some code checking 199 | * tools do identify and complain about seemingly 200 | * irrelevant differences. For example, a code 201 | * checking tool may complain about an implicit 202 | * conversion from int to short even though both 203 | * are 16 bits. To reduce these types of 204 | * complaints, it is best to make int the 205 | * preferred choice when more than one is available. 206 | */ 207 | 208 | #ifndef INT8_T 209 | # if defined(MW_LIBTOOLING) 210 | # define INT8_T int8_t 211 | # elif TMW_BITS_PER_INT == 8 212 | # define INT8_T int 213 | # elif TMW_BITS_PER_LONG == 8 214 | # define INT8_T long 215 | # elif TMW_BITS_PER_SCHAR == 8 216 | # define INT8_T signed char 217 | # elif TMW_BITS_PER_SHRT == 8 218 | # define INT8_T short 219 | # endif 220 | #endif 221 | #ifdef INT8_T 222 | typedef INT8_T int8_T; 223 | #endif 224 | 225 | #ifndef UINT8_T 226 | # if defined(MW_LIBTOOLING) 227 | # define UINT8_T uint8_t 228 | # elif TMW_BITS_PER_INT == 8 229 | # define UINT8_T unsigned int 230 | # elif TMW_BITS_PER_LONG == 8 231 | # define UINT8_T unsigned long 232 | # elif TMW_BITS_PER_SCHAR == 8 233 | # define UINT8_T unsigned char 234 | # elif TMW_BITS_PER_SHRT == 8 235 | # define UINT8_T unsigned short 236 | # endif 237 | #endif 238 | #ifdef UINT8_T 239 | typedef UINT8_T uint8_T; 240 | #endif 241 | 242 | 243 | #ifndef INT16_T 244 | # if defined(MW_LIBTOOLING) 245 | # define INT16_T int16_t 246 | # elif TMW_BITS_PER_INT == 16 247 | # define INT16_T int 248 | # elif TMW_BITS_PER_LONG == 16 249 | # define INT16_T long 250 | # elif TMW_BITS_PER_SCHAR == 16 251 | # define INT16_T signed char 252 | # elif TMW_BITS_PER_SHRT == 16 253 | # define INT16_T short 254 | # endif 255 | #endif 256 | #ifdef INT16_T 257 | typedef INT16_T int16_T; 258 | #endif 259 | 260 | 261 | #ifndef UINT16_T 262 | # if defined(MW_LIBTOOLING) 263 | # define UINT16_T uint16_t 264 | # elif TMW_BITS_PER_INT == 16 265 | # define UINT16_T unsigned int 266 | # elif TMW_BITS_PER_LONG == 16 267 | # define UINT16_T unsigned long 268 | # elif TMW_BITS_PER_SCHAR == 16 269 | # define UINT16_T unsigned char 270 | # elif TMW_BITS_PER_SHRT == 16 271 | # define UINT16_T unsigned short 272 | # endif 273 | #endif 274 | #ifdef UINT16_T 275 | typedef UINT16_T uint16_T; 276 | #endif 277 | 278 | 279 | #ifndef INT32_T 280 | # if defined(MW_LIBTOOLING) 281 | # define INT32_T int32_t 282 | # elif TMW_BITS_PER_INT == 32 283 | # define INT32_T int 284 | # elif TMW_BITS_PER_LONG == 32 285 | # define INT32_T long 286 | # elif TMW_BITS_PER_SCHAR == 32 287 | # define INT32_T signed char 288 | # elif TMW_BITS_PER_SHRT == 32 289 | # define INT32_T short 290 | # endif 291 | #endif 292 | #ifdef INT32_T 293 | typedef INT32_T int32_T; 294 | #endif 295 | 296 | 297 | #ifndef UINT32_T 298 | # if defined(MW_LIBTOOLING) 299 | # define UINT32_T uint32_t 300 | # elif TMW_BITS_PER_INT == 32 301 | # define UINT32_T unsigned int 302 | # elif TMW_BITS_PER_LONG == 32 303 | # define UINT32_T unsigned long 304 | # elif TMW_BITS_PER_SCHAR == 32 305 | # define UINT32_T unsigned char 306 | # elif TMW_BITS_PER_SHRT == 32 307 | # define UINT32_T unsigned short 308 | # endif 309 | #endif 310 | #ifdef UINT32_T 311 | typedef UINT32_T uint32_T; 312 | #endif 313 | 314 | /* The following is used to emulate smaller integer types when only 315 | * larger types are available. For example, compilers for TI C3x/C4x DSPs 316 | * define char and short to be 32 bits, so 8 and 16 bits are not directly 317 | * available. This target is commonly used with RTW rapid prototyping. 318 | * Other DSPs define char to be 16 bits, so 8 bits is not directly 319 | * available. 320 | */ 321 | #ifndef INT8_T 322 | # ifdef INT16_T 323 | # define INT8_T INT16_T 324 | typedef INT8_T int8_T; 325 | # else 326 | # ifdef INT32_T 327 | # define INT8_T INT32_T 328 | typedef INT8_T int8_T; 329 | # endif 330 | # endif 331 | #endif 332 | 333 | #ifndef UINT8_T 334 | # ifdef UINT16_T 335 | # define UINT8_T UINT16_T 336 | typedef UINT8_T uint8_T; 337 | # else 338 | # ifdef UINT32_T 339 | # define UINT8_T UINT32_T 340 | typedef UINT8_T uint8_T; 341 | # endif 342 | # endif 343 | #endif 344 | 345 | #ifndef INT16_T 346 | # ifdef INT32_T 347 | # define INT16_T INT32_T 348 | typedef INT16_T int16_T; 349 | # endif 350 | #endif 351 | 352 | #ifndef UINT16_T 353 | # ifdef UINT32_T 354 | # define UINT16_T UINT32_T 355 | typedef UINT16_T uint16_T; 356 | # endif 357 | #endif 358 | 359 | 360 | #ifndef NO_FLOATS 361 | 362 | #ifndef REAL32_T 363 | # ifndef __MWERKS__ 364 | # if FLT_MANT_DIG >= 23 365 | # define REAL32_T float 366 | # endif 367 | # else 368 | # define REAL32_T float 369 | # endif 370 | #endif 371 | #ifdef REAL32_T 372 | typedef REAL32_T real32_T; 373 | #endif 374 | 375 | 376 | #ifndef REAL64_T 377 | # ifndef __MWERKS__ 378 | # if DBL_MANT_DIG >= 52 379 | # define REAL64_T double 380 | # endif 381 | # else 382 | # define REAL64_T double 383 | # endif 384 | #endif 385 | #ifdef REAL64_T 386 | typedef REAL64_T real64_T; 387 | #endif 388 | 389 | #endif /* NO_FLOATS*/ 390 | 391 | /*=======================================================================* 392 | * Fixed width word size data types: * 393 | * int64_T - signed 64 bit integers * 394 | * uint64_T - unsigned 64 bit integers * 395 | *=======================================================================*/ 396 | 397 | # if defined(MW_LIBTOOLING) 398 | # ifdef INT64_T 399 | # undef INT64_T 400 | # endif 401 | # define INT64_T int64_t 402 | # ifdef UINT64_T 403 | # undef UINT64_T 404 | # endif 405 | # define UINT64_T uint64_t 406 | # endif 407 | #if !defined(INT64_T) || !defined(UINT64_T) || !defined(FMT64) 408 | # if defined(__APPLE__) || defined(__clang__) 409 | # ifndef INT64_T 410 | # define INT64_T long long 411 | # endif 412 | # ifndef UINT64_T 413 | # define UINT64_T unsigned long long 414 | # endif 415 | # ifndef FMT64 416 | # define FMT64 "ll" 417 | # endif 418 | # if defined(__LP64__) && !defined(INT_TYPE_64_IS_LONG) 419 | # define INT_TYPE_64_IS_LONG 420 | # endif 421 | # elif (defined(__x86_64__) || defined(__LP64__))&& !defined(__MINGW64__) 422 | # ifndef INT64_T 423 | # define INT64_T long 424 | # endif 425 | # ifndef UINT64_T 426 | # define UINT64_T unsigned long 427 | # endif 428 | # ifndef FMT64 429 | # define FMT64 "l" 430 | # endif 431 | # if !defined(INT_TYPE_64_IS_LONG) 432 | # define INT_TYPE_64_IS_LONG 433 | # endif 434 | # elif defined(_MSC_VER) || (defined(__BORLANDC__) && __BORLANDC__ >= 0x530) \ 435 | || (defined(__WATCOMC__) && __WATCOMC__ >= 1100) 436 | # ifndef INT64_T 437 | # define INT64_T __int64 438 | # endif 439 | # ifndef UINT64_T 440 | # define UINT64_T unsigned __int64 441 | # endif 442 | # ifndef FMT64 443 | # define FMT64 "I64" 444 | # endif 445 | # elif defined(__GNUC__) || defined(TMW_ENABLE_INT64) \ 446 | || defined(__LCC64__) 447 | # ifndef INT64_T 448 | # define INT64_T long long 449 | # endif 450 | # ifndef UINT64_T 451 | # define UINT64_T unsigned long long 452 | # endif 453 | # ifndef FMT64 454 | # define FMT64 "ll" 455 | # endif 456 | # endif 457 | 458 | #endif 459 | 460 | #if defined(INT64_T) 461 | # if defined(__GNUC__) && \ 462 | ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >=9))) 463 | __extension__ 464 | # endif 465 | typedef INT64_T int64_T; 466 | #endif 467 | 468 | #if defined(_WIN64) || (defined(__APPLE__) && defined(__LP64__)) \ 469 | || defined(__x86_64__) \ 470 | || defined(__LP64__) 471 | # define INT_TYPE_64_IS_SUPPORTED 472 | #endif 473 | 474 | #if defined(UINT64_T) 475 | # if defined(__GNUC__) && \ 476 | ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >=9))) 477 | __extension__ 478 | # endif 479 | typedef UINT64_T uint64_T; 480 | #endif 481 | 482 | /*===========================================================================* 483 | * Format string modifiers for using size_t variables in printf statements. * 484 | *===========================================================================*/ 485 | 486 | #ifndef FMT_SIZE_T 487 | # if (defined( __GNUC__ ) || defined(_STDC_C99))&& !defined(__MINGW64__) 488 | # define FMT_SIZE_T "z" 489 | # elif defined (__WATCOMC__) 490 | # define FMT_SIZE_T "l" 491 | # elif defined (_WIN32 ) 492 | # define FMT_SIZE_T "I" 493 | # else 494 | # define FMT_SIZE_T "l" 495 | # endif 496 | #endif 497 | 498 | #ifndef FMT_PTRDIFF_T 499 | # if defined(__APPLE__) 500 | # define FMT_PTRDIFF_T "l" 501 | # elif defined( __GNUC__ ) || defined(_STDC_C99) 502 | # define FMT_PTRDIFF_T "t" 503 | # elif defined (__WATCOMC__) 504 | # define FMT_PTRDIFF_T "l" 505 | # elif defined (_WIN32 ) 506 | # define FMT_PTRDIFF_T "I" 507 | # else 508 | # define FMT_PTRDIFF_T "l" 509 | # endif 510 | #endif 511 | 512 | /*===========================================================================* 513 | * General or logical data types where the word size is not guaranteed. * 514 | * real_T - possible settings include real32_T or real64_T * 515 | * time_T - possible settings include real32_T or real64_T * 516 | * boolean_T * 517 | * char_T * 518 | * int_T * 519 | * uint_T * 520 | * byte_T * 521 | *===========================================================================*/ 522 | 523 | #ifndef NO_FLOATS 524 | 525 | #ifndef REAL_T 526 | # ifdef REAL64_T 527 | # define REAL_T real64_T 528 | # else 529 | # ifdef REAL32_T 530 | # define REAL_T real32_T 531 | # endif 532 | # endif 533 | #endif 534 | #ifdef REAL_T 535 | typedef REAL_T real_T; 536 | #endif 537 | 538 | #ifndef TIME_T 539 | # ifdef REAL_T 540 | # define TIME_T real_T 541 | # endif 542 | #endif 543 | #ifdef TIME_T 544 | typedef TIME_T time_T; 545 | #endif 546 | 547 | #endif /* NO_FLOATS */ 548 | 549 | #ifndef BOOLEAN_T 550 | # if defined(UINT8_T) 551 | # define BOOLEAN_T UINT8_T 552 | # else 553 | # define BOOLEAN_T unsigned int 554 | # endif 555 | #endif 556 | typedef BOOLEAN_T boolean_T; 557 | 558 | 559 | #ifndef CHARACTER_T 560 | # define CHARACTER_T char 561 | #endif 562 | typedef CHARACTER_T char_T; 563 | 564 | 565 | #ifndef INTEGER_T 566 | # define INTEGER_T int 567 | #endif 568 | typedef INTEGER_T int_T; 569 | 570 | 571 | #ifndef UINTEGER_T 572 | # define UINTEGER_T unsigned 573 | #endif 574 | typedef UINTEGER_T uint_T; 575 | 576 | 577 | #ifndef BYTE_T 578 | # define BYTE_T unsigned char 579 | #endif 580 | typedef BYTE_T byte_T; 581 | 582 | 583 | /*===========================================================================* 584 | * Define Complex Structures * 585 | *===========================================================================*/ 586 | #ifndef NO_FLOATS 587 | 588 | #ifndef CREAL32_T 589 | # ifdef REAL32_T 590 | typedef struct { 591 | real32_T re, im; 592 | } creal32_T; 593 | # define CREAL32_T creal32_T 594 | # endif 595 | #endif 596 | 597 | #ifndef CREAL64_T 598 | # ifdef REAL64_T 599 | typedef struct { 600 | real64_T re, im; 601 | } creal64_T; 602 | # define CREAL64_T creal64_T 603 | # endif 604 | #endif 605 | 606 | #ifndef CREAL_T 607 | # ifdef REAL_T 608 | typedef struct { 609 | real_T re, im; 610 | } creal_T; 611 | # define CREAL_T creal_T 612 | # endif 613 | #endif 614 | 615 | #endif /* NO_FLOATS */ 616 | 617 | #ifndef CINT8_T 618 | # ifdef INT8_T 619 | typedef struct { 620 | int8_T re, im; 621 | } cint8_T; 622 | # define CINT8_T cint8_T 623 | # endif 624 | #endif 625 | 626 | #ifndef CUINT8_T 627 | # ifdef UINT8_T 628 | typedef struct { 629 | uint8_T re, im; 630 | } cuint8_T; 631 | # define CUINT8_T cuint8_T 632 | # endif 633 | #endif 634 | 635 | #ifndef CINT16_T 636 | # ifdef INT16_T 637 | typedef struct { 638 | int16_T re, im; 639 | } cint16_T; 640 | # define CINT16_T cint16_T 641 | # endif 642 | #endif 643 | 644 | #ifndef CUINT16_T 645 | # ifdef UINT16_T 646 | typedef struct { 647 | uint16_T re, im; 648 | } cuint16_T; 649 | # define CUINT16_T cuint16_T 650 | # endif 651 | #endif 652 | 653 | #ifndef CINT32_T 654 | # ifdef INT32_T 655 | typedef struct { 656 | int32_T re, im; 657 | } cint32_T; 658 | # define CINT32_T cint32_T 659 | # endif 660 | #endif 661 | 662 | #ifndef CUINT32_T 663 | # ifdef UINT32_T 664 | typedef struct { 665 | uint32_T re, im; 666 | } cuint32_T; 667 | # define CUINT32_T cuint32_T 668 | # endif 669 | #endif 670 | 671 | #ifndef CINT64_T 672 | # ifdef INT64_T 673 | typedef struct { 674 | int64_T re, im; 675 | } cint64_T; 676 | # define CINT64_T cint64_T 677 | # endif 678 | #endif 679 | 680 | #ifndef CUINT64_T 681 | # ifdef UINT64_T 682 | typedef struct { 683 | uint64_T re, im; 684 | } cuint64_T; 685 | # define CUINT64_T cuint64_T 686 | # endif 687 | #endif 688 | 689 | /*=======================================================================* 690 | * Min and Max: * 691 | * int8_T, int16_T, int32_T - signed 8, 16, or 32 bit integers * 692 | * uint8_T, uint16_T, uint32_T - unsigned 8, 16, or 32 bit integers * 693 | *=======================================================================*/ 694 | 695 | #define MAX_int8_T ((int8_T)(127)) /* 127 */ 696 | #define MIN_int8_T ((int8_T)(-128)) /* -128 */ 697 | #define MAX_uint8_T ((uint8_T)(255)) /* 255 */ 698 | #define MIN_uint8_T ((uint8_T)(0)) 699 | 700 | #define MAX_int16_T ((int16_T)(32767)) /* 32767 */ 701 | #define MIN_int16_T ((int16_T)(-32768)) /* -32768 */ 702 | #define MAX_uint16_T ((uint16_T)(65535)) /* 65535 */ 703 | #define MIN_uint16_T ((uint16_T)(0)) 704 | 705 | #define MAX_int32_T ((int32_T)(2147483647)) /* 2147483647 */ 706 | #define MIN_int32_T ((int32_T)(-2147483647-1)) /* -2147483648 */ 707 | #define MAX_uint32_T ((uint32_T)(0xFFFFFFFFU)) /* 4294967295 */ 708 | #define MIN_uint32_T ((uint32_T)(0)) 709 | 710 | #if defined(_MSC_VER) || (defined(__BORLANDC__) && __BORLANDC__ >= 0x530) \ 711 | || (defined(__WATCOMC__) && __WATCOMC__ >= 1100) \ 712 | || defined(__LCC64__) 713 | # ifdef INT64_T 714 | # define MAX_int64_T ((int64_T)(9223372036854775807LL)) 715 | # define MIN_int64_T ((int64_T)(-9223372036854775807LL-1LL)) 716 | # endif 717 | # ifdef UINT64_T 718 | # define MAX_uint64_T ((uint64_T)(0xFFFFFFFFFFFFFFFFULL)) 719 | # define MIN_uint64_T ((uint64_T)(0)) 720 | # endif 721 | #else 722 | # ifdef INT64_T 723 | # ifdef INT_TYPE_64_IS_LONG 724 | # define MAX_int64_T ((int64_T)(9223372036854775807L)) 725 | # define MIN_int64_T ((int64_T)(-9223372036854775807L-1L)) 726 | # else 727 | # define MAX_int64_T ((int64_T)(9223372036854775807LL)) 728 | # define MIN_int64_T ((int64_T)(-9223372036854775807LL-1LL)) 729 | # endif 730 | # endif 731 | # ifdef UINT64_T 732 | # ifdef INT_TYPE_64_IS_LONG 733 | # define MAX_uint64_T ((uint64_T)(0xFFFFFFFFFFFFFFFFUL)) 734 | # define MIN_uint64_T ((uint64_T)(0)) 735 | # else 736 | # define MAX_uint64_T ((uint64_T)(0xFFFFFFFFFFFFFFFFULL)) 737 | # define MIN_uint64_T ((uint64_T)(0)) 738 | # endif 739 | # endif 740 | #endif 741 | 742 | #if (defined(_MSC_VER) && !defined(__clang__)) 743 | 744 | /* Conversion from unsigned __int64 to double is not implemented in Visual Studio 745 | * and results in a compile error, thus the value must first be cast to 746 | * signed __int64, and then to double. 747 | * 748 | * If the 64 bit int value is greater than 2^63-1, which is the signed int64 max, 749 | * the macro below provides a workaround for casting a uint64 value to a double 750 | * in windows. 751 | */ 752 | # define uint64_to_double(u) ( ((u) > _I64_MAX) ? \ 753 | (double)(__int64)((u) - _I64_MAX - 1) + (double)_I64_MAX + 1: \ 754 | (double)(__int64)(u) ) 755 | 756 | /* The following inline function should only be used in the macro double_to_uint64, 757 | * as it only handles the specfic range of double between 2^63 and 2^64-1 */ 758 | __forceinline 759 | uint64_T double_to_uint64_helper(double d) { 760 | union double_to_uint64_union_type { 761 | double dd; 762 | uint64_T i64; 763 | } di; 764 | di.dd = d; 765 | return (((di.i64 & 0x000fffffffffffff) | 0x0010000000000000) << 11); 766 | } 767 | 768 | /* The largest double value that can be cast to uint64 in windows is the 769 | * signed int64 max, which is 2^63-1. The macro below provides 770 | * a workaround for casting large double values to uint64 in windows. 771 | */ 772 | /* The magic number 18446744073709551616.0 is 2^64 */ 773 | /* The magic number 9223372036854775808.0 is 2^63 */ 774 | # define double_to_uint64(d) ( ((d) >= 18446744073709551616.0) ? \ 775 | 0xffffffffffffffffULL : \ 776 | ((d) >= 0.0) ? \ 777 | ((d) >= 9223372036854775808.0) ? \ 778 | double_to_uint64_helper(d) : \ 779 | (unsigned __int64)(d) : \ 780 | 0ULL ) 781 | #else 782 | # define uint64_to_double(u) ((double)(u)) 783 | # if defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__TICCSC__) 784 | /* double_to_uint64 defined only for MSVC and UNIX */ 785 | # else 786 | # define double_to_uint64(d) ( ((d) >= 18446744073709551616.0) ? \ 787 | (unsigned long long) 0xffffffffffffffffULL : \ 788 | ((d) >= 0) ? (unsigned long long)(d) : (unsigned long long) 0 ) 789 | # endif 790 | #endif 791 | 792 | #if !defined(__cplusplus) && !defined(__bool_true_false_are_defined) 793 | 794 | #ifndef _bool_T 795 | #define _bool_T 796 | 797 | typedef boolean_T bool; 798 | 799 | #ifndef false 800 | #define false (0) 801 | #endif 802 | #ifndef true 803 | #define true (1) 804 | #endif 805 | 806 | #endif /* _bool_T */ 807 | 808 | #endif /* !__cplusplus */ 809 | 810 | /* 811 | * This software assumes that the code is being compiled on a target using a 812 | * 2's complement representation for signed integer values. 813 | */ 814 | #if ((SCHAR_MIN + 1) != -SCHAR_MAX) 815 | #error "This code must be compiled using a 2's complement representation for signed integer values" 816 | #endif 817 | 818 | /* 819 | * Maximum length of a MATLAB identifier (function/variable/model) 820 | * including the null-termination character. 821 | */ 822 | #define TMW_NAME_LENGTH_MAX 64 823 | 824 | /* 825 | * Maximum values for indices and dimensions 826 | */ 827 | #include 828 | 829 | #ifdef MX_COMPAT_32 830 | typedef int mwSize; 831 | typedef int mwIndex; 832 | typedef int mwSignedIndex; 833 | #else 834 | typedef size_t mwSize; /* unsigned pointer-width integer */ 835 | typedef size_t mwIndex; /* unsigned pointer-width integer */ 836 | typedef ptrdiff_t mwSignedIndex; /* a signed pointer-width integer */ 837 | #endif 838 | 839 | /* for the individual dim */ 840 | /* If updating SLSize or SLIndex, update defintions in sl_types_def.h 841 | as well. */ 842 | #ifndef SLSIZE_SLINDEX 843 | #define SLSIZE_SLINDEX 844 | #ifdef INT_TYPE_64_IS_SUPPORTED 845 | typedef int64_T SLIndex; 846 | typedef int64_T SLSize; 847 | #else 848 | typedef int SLIndex; 849 | typedef int SLSize; 850 | #endif 851 | #endif 852 | 853 | /* for the total size */ 854 | #define SLIndexType size_t 855 | #define INVALID_SIZET_VALUE (std::numeric_limits::max()) 856 | #define MAX_VALID_SIZET_VALUE (std::numeric_limits::max() -1) 857 | 858 | 859 | #if (defined(_LP64) || defined(_WIN64)) && !defined(MX_COMPAT_32) 860 | /* Currently 2^48 based on hardware limitations */ 861 | # define MWSIZE_MAX 281474976710655UL 862 | # define MWINDEX_MAX 281474976710655UL 863 | # define MWSINDEX_MAX 281474976710655L 864 | # define MWSINDEX_MIN -281474976710655L 865 | #else 866 | # define MWSIZE_MAX 2147483647UL 867 | # define MWINDEX_MAX 2147483647UL 868 | # define MWSINDEX_MAX 2147483647L 869 | # define MWSINDEX_MIN -2147483647L 870 | #endif 871 | #define MWSIZE_MIN 0UL 872 | #define MWINDEX_MIN 0UL 873 | 874 | /** UTF-16 character type */ 875 | 876 | #if (defined(__cplusplus) && (__cplusplus >= 201103L)) || (defined(_HAS_CHAR16_T_LANGUAGE_SUPPORT) && _HAS_CHAR16_T_LANGUAGE_SUPPORT) 877 | typedef char16_t CHAR16_T; 878 | #define U16_STRING_LITERAL_PREFIX u 879 | #elif defined(_MSC_VER) 880 | typedef wchar_t CHAR16_T; 881 | #define U16_STRING_LITERAL_PREFIX L 882 | #else 883 | typedef UINT16_T CHAR16_T; 884 | #endif 885 | 886 | #endif /* __TMWTYPES__ */ 887 | 888 | #endif /* tmwtypes_h */ 889 | -------------------------------------------------------------------------------- /C_project/C_DISLIN/VS2022/x64/Debug/Filter_Design.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/C_DISLIN/VS2022/x64/Debug/Filter_Design.exe -------------------------------------------------------------------------------- /C_project/C_DISLIN/VS2022/x64/Release/Filter_Design.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/C_project/C_DISLIN/VS2022/x64/Release/Filter_Design.exe -------------------------------------------------------------------------------- /M_C_project/check_num_input.m: -------------------------------------------------------------------------------- 1 | function param_p = check_num_input(param_p,limits,text_id,c_param) 2 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3 | % Function: check_num_input() 4 | % Goal : Checks a numerical input parameter given by the user 5 | % 6 | % IN : - limits : boundaries allowed for the desired parameter 7 | % - text_id: text to display related to the desired parameter 8 | % - c_param: type of C data 9 | % IN/OUT : - param_p: parameter to set via the user interface 10 | % OUT : - 11 | % 12 | % Copyright 2024 The MathWorks, Inc. 13 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 14 | %#codegen 15 | %#ok<*NASGU> 16 | 17 | % Constant 18 | % Force the string regular expression in the generated C code for scanf_s 19 | CLEAR_STDIN = coder.opaque('char *','"%*[^\n]%*1[\n]"'); 20 | 21 | % Initialization 22 | nb_params = int32(0); 23 | negate_bool = int32(1); 24 | 25 | % Check user's input 26 | while(1) 27 | % Ask the user to enter a number 28 | fprintf('%s',text_id); 29 | nb_params = coder.ceval('scanf_s',c_param,coder.wref(param_p),int32(1)); 30 | % Check if a number or some chars have been entered 31 | if (nb_params == 1) 32 | % One entry => this is a number 33 | negate_bool = int32(0); 34 | else 35 | % Multiple entries => this is an array of chars 36 | negate_bool = int32(1); 37 | end 38 | % Post process the keyboard input buffer data 39 | if (negate_bool == 1) 40 | fprintf('The value provided is not of the right data type.\n'); 41 | fprintf('Please, enter a correct value.\n'); 42 | % Clear the input buffer 43 | coder.ceval('scanf_s',CLEAR_STDIN); 44 | else 45 | % Compare the entry to the possible data range 46 | if (param_p >= limits(1) && param_p <= limits(2)) 47 | % The parameter stands into the correct range 48 | break; 49 | else 50 | fprintf('For this filter, the parameter should be between %.3f and %.3f.\n',... 51 | limits(1),limits(2)); 52 | fprintf('Please, enter a correct value.\n'); 53 | end 54 | end 55 | end 56 | end 57 | -------------------------------------------------------------------------------- /M_C_project/check_str_input.m: -------------------------------------------------------------------------------- 1 | function param_p = check_str_input(param_p,text_id) 2 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3 | % Function: check_str_input() 4 | % Goal : Checks string input parameter given by the user 5 | % 6 | % IN : - text_id: text to display related to the desired parameter 7 | % IN/OUT : - param_p: parameter to set via the user interface 8 | % OUT : - 9 | % 10 | % Copyright 2024 The MathWorks, Inc. 11 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 12 | %#codegen 13 | % Constants 14 | ERROR_MESSAGE = ['Unknown filter type. Please, enter a correct one.',0]; 15 | FILTER = [['low',0,0];['high',0];['band',0];['stop',0]]; 16 | NB_FILTERS = int32(4); 17 | 18 | % Initialization 19 | negate_bool = int32(1); 20 | char_length = int32(2); % sizeof(char) 21 | nb_input_types = int32(0); %#ok 22 | 23 | % Loop to get and validate user's input 24 | while(1) 25 | % Ask the user to enter a filter type 26 | fprintf('%s',text_id); 27 | coder.ceval('scanf_s','%4s',coder.wref(param_p),int32(4)*char_length); 28 | % Compare the entry to the available types 29 | for i=int32(1):1:NB_FILTERS 30 | negate_bool = coder.ceval('strcmp',param_p,FILTER(i,:)); 31 | if (negate_bool == 0) 32 | break; % No need to go on with the FOR loop 33 | end 34 | end 35 | if (negate_bool == 0) 36 | break; % Leave the WHILE loop because one type matches the entry 37 | else 38 | % No right type selected 39 | fprintf('%s\n',ERROR_MESSAGE); 40 | % Force the string regular expression in the generated C code for scanf_s 41 | CLEAR_STDIN = coder.opaque('char *','"%*[^\n]%*1[\n]"'); 42 | % Clear the input buffer 43 | coder.ceval('scanf_s', CLEAR_STDIN); 44 | end 45 | end 46 | end 47 | -------------------------------------------------------------------------------- /M_C_project/check_yes_or_no.m: -------------------------------------------------------------------------------- 1 | function param_p = check_yes_or_no(param_p,text_id) 2 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3 | % Function: check_yes_or_no() 4 | % Goal : Checks if the given parameter is either 'yes' or 'no' 5 | % 6 | % IN : - text_id: text to display related to the desired parameter 7 | % IN/OUT : - param_p: parameter to set via the user interface 8 | % OUT : - 9 | % 10 | % Copyright 2024 The MathWorks, Inc. 11 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 12 | %#codegen 13 | % Constants 14 | NEW_LINE = char(10); %#ok 15 | ERROR_MESSAGE = ['Please, enter [y,Y] for YES or [n,N] for NO.',NEW_LINE,0]; 16 | N_CHAR = ['n',0]; 17 | Y_CHAR = ['y',0]; 18 | 19 | % Initialization 20 | negate_bool = int32(ones(1,2)); 21 | char_length = int32(2); % sizeof(char) 22 | 23 | % Loop to get and validate user's input 24 | while(1) 25 | % Ask the user to enter a selection 26 | fprintf('%s',text_id); 27 | coder.ceval('scanf_s','%s',coder.wref(param_p),char_length); 28 | % Compare the entry to the available types 29 | negate_bool(1) = coder.ceval('_strcmpi',param_p,N_CHAR); 30 | negate_bool(2) = coder.ceval('_strcmpi',param_p,Y_CHAR); 31 | if (negate_bool(1) == 0 || negate_bool(2) == 0) 32 | % Handle graphical windows in C 33 | break; 34 | else 35 | fprintf('%s\n',ERROR_MESSAGE); 36 | % Force the string regular expression in the generated C code for scanf_s 37 | CLEAR_STDIN = coder.opaque('char *','"%*[^\n]%*1[\n]"'); 38 | % Clear the input buffer 39 | coder.ceval('scanf_s', CLEAR_STDIN); 40 | end 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /M_C_project/filter_bode.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/M_C_project/filter_bode.m -------------------------------------------------------------------------------- /M_C_project/main.m: -------------------------------------------------------------------------------- 1 | function error_flag = main() 2 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3 | % Function: main() 4 | % Goal : Main C function of the executable 5 | % 6 | % IN : - 7 | % IN/OUT : - 8 | % OUT : - 9 | % 10 | % Copyright 2024 The MathWorks, Inc. 11 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 12 | %#codegen 13 | % Functions that are not translated into C code 14 | coder.extrinsic('plot_filter'); 15 | 16 | % Constants 17 | SEPARATOR = ['-------------------------------------------------------------------------------',0]; 18 | TITLE = ['--------------------------- FILTER DESIGN AND VIEWER --------------------------',0]; 19 | FILTER_TYPE = ['Type of filter [low][high][band][stop]: ',0]; 20 | FILTER_ORDER = ['Order of the filter: ',0]; 21 | CUTOFF_FREQ = ['Cutoff frequency: ',0]; 22 | QUALITY_FAC = ['Quality factor: ',0]; 23 | LINEAR_GAIN = ['Linear gain of the filter: ',0]; 24 | BAND_FILTER = ['band',0]; 25 | STOP_FILTER = ['stop',0]; 26 | N_CHAR = ['n',0]; 27 | PREV_BODES = ['Do you want to keep the previous Bodes [y,n]? ',0]; 28 | OTHER_BODES = ['Do you want to see Bodes of another filter [y,n]? ',0]; 29 | ERROR_TEXT = ['Bodes cannot be maid due to a misconfiguration of parameters.',0]; 30 | ERROR_T_TEXT = ['This type of filter is not supported.',0]; 31 | ERROR_N_TEXT = ['This order value is not supported for such filters. It must be an even value.',0]; 32 | ERROR_U_TEXT = ['Unknown error. Please re-submit filter''s parameters.',0]; 33 | ERROR_TYPE = int32(1); 34 | ERROR_ORDER = int32(2); 35 | POWER_F_MIN = 0; 36 | POWER_F_MAX = 9; 37 | NB_PTS = 1e005; 38 | ORDER_LIMS_1 = [1 10]; 39 | ORDER_LIMS_2 = [2 10]; 40 | QUAL_LIMS = [0.1 10]; 41 | GAIN_LIMS = [0.001 1000]; 42 | INTEGER = coder.opaque('char *','"%d"'); 43 | LONG_DOUBLE = coder.opaque('char *','"%lf"'); 44 | 45 | % Initialization 46 | error_flag = int32(0); 47 | f_0 = double(0); 48 | q_0 = double(0); 49 | g = double(1); 50 | n_f = int32(0); 51 | f_t = ['0000',0]; 52 | negate_bool = int32(1); %#ok<*NASGU> 53 | neg_band_bool = int32(1); 54 | neg_stop_bool = int32(1); 55 | fig_id = int32(0); 56 | keep_bodes = ['0',0]; 57 | new_bodes = ['0',0]; 58 | 59 | % Definition of the logarithmic frequency range 60 | f = logspace(POWER_F_MIN,POWER_F_MAX,NB_PTS); 61 | frequency_range = 10.^[POWER_F_MIN,POWER_F_MAX]; 62 | 63 | % Program title 64 | fprintf('%s\n',SEPARATOR); 65 | fprintf('%s\n',TITLE); 66 | fprintf('%s\n',SEPARATOR); 67 | 68 | % Forever loop 69 | while(1) 70 | % Ask for filter's parameters 71 | f_t = check_str_input(f_t,FILTER_TYPE); 72 | neg_band_bool = coder.ceval('strcmp',coder.rref(f_t),BAND_FILTER); 73 | neg_stop_bool = coder.ceval('strcmp',coder.rref(f_t),STOP_FILTER); 74 | if (neg_band_bool == 0 || neg_stop_bool == 0) 75 | n_f = check_num_input(n_f,ORDER_LIMS_2,FILTER_ORDER,INTEGER); 76 | else 77 | n_f = check_num_input(n_f,ORDER_LIMS_1,FILTER_ORDER,INTEGER); 78 | end 79 | f_0 = check_num_input(f_0,frequency_range,CUTOFF_FREQ,LONG_DOUBLE); 80 | if (n_f > 1) 81 | q_0 = check_num_input(q_0,QUAL_LIMS,QUALITY_FAC,LONG_DOUBLE); 82 | end 83 | g = check_num_input(g,GAIN_LIMS,LINEAR_GAIN,LONG_DOUBLE); 84 | 85 | % Bodes calculation 86 | [H_mod,H_arg,error_flag] = filter_bode(f,f_0,q_0,g,f_t,n_f); 87 | % Display of results (target dependent) 88 | if (error_flag == 0) 89 | fig_id = fig_id+1; 90 | plot_filter(f,H_mod,H_arg,f_t,n_f,fig_id); 91 | else % An error occured and bodes cannot be plotted 92 | disp(ERROR_TEXT); 93 | switch (error_flag) 94 | case ERROR_TYPE 95 | disp(ERROR_T_TEXT); 96 | case ERROR_ORDER 97 | disp(ERROR_N_TEXT); 98 | otherwise 99 | disp(ERROR_U_TEXT); 100 | end 101 | end 102 | 103 | % Ask the user if he wants to keep the previous graphs 104 | keep_bodes = check_yes_or_no(keep_bodes,PREV_BODES); 105 | negate_bool = coder.ceval('_strcmpi',coder.rref(keep_bodes),N_CHAR); 106 | if (negate_bool == 0) 107 | fig_id = fig_id-1; 108 | % C implementation in order to close the previous windows 109 | end 110 | % Ask the user if he wants to see other filter's Bodes 111 | new_bodes = check_yes_or_no(new_bodes,OTHER_BODES); 112 | negate_bool = coder.ceval('_strcmpi',coder.rref(new_bodes),N_CHAR); 113 | if (negate_bool == 0) 114 | break; 115 | % C implementation in order to quit the console 116 | end 117 | fprintf('%s\n',SEPARATOR); 118 | end 119 | end 120 | -------------------------------------------------------------------------------- /M_C_project/plot_filter.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/M_C_project/plot_filter.m -------------------------------------------------------------------------------- /M_C_project/test_main.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Goal : Test of the main_mex() function 3 | % Copyright 2024 The MathWorks, Inc. 4 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5 | clear variables; close all; clc; 6 | 7 | % Test the MEX file if set to '1' 8 | TEST_MEX = 0; 9 | if (TEST_MEX == 0) 10 | % Call of the standard MATLAB code 11 | error('The coder.ceval function is not supported in MATLAB. Generate the MEX file.'); 12 | else 13 | % Call of the MEX function 14 | error('The write access to the console via scanf() or scanf_s() is not supported in MATLAB.'); 15 | end 16 | -------------------------------------------------------------------------------- /M_MEX_project/Deployment/FilterDesign.ctf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/M_MEX_project/Deployment/FilterDesign.ctf -------------------------------------------------------------------------------- /M_MEX_project/Deployment/FilterDesign.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/M_MEX_project/Deployment/FilterDesign.exe -------------------------------------------------------------------------------- /M_MEX_project/Deployment/FilterDesignCompiler.prj: -------------------------------------------------------------------------------- 1 | 2 | 3 | FilterDesign 4 | ${PROJECT_ROOT}\FilterDesignCompiler_resources\icon.ico 5 | 6 | ${PROJECT_ROOT}\FilterDesignCompiler_resources\icon_48.png 7 | ${PROJECT_ROOT}\FilterDesignCompiler_resources\icon_32.png 8 | ${PROJECT_ROOT}\FilterDesignCompiler_resources\icon_24.png 9 | ${PROJECT_ROOT}\FilterDesignCompiler_resources\icon_16.png 10 | 11 | 1.1 12 | Copyright 2024 The MathWorks, Inc. 13 | 14 | MathWorks 15 | Design analog filters interactively 16 | 17 | ${PROJECT_ROOT}\splash_screen.png 18 | 19 | \MathWorks\FilterDesign\ 20 | option.installpath.programfiles 21 | 22 | 23 | 24 | ${PROJECT_ROOT}\for_testing 25 | ${PROJECT_ROOT}\for_redistribution_files_only 26 | ${PROJECT_ROOT}\for_redistribution 27 | ${PROJECT_ROOT}\FilterDesignCompiler 28 | false 29 | 30 | subtarget.standalone 31 | 32 | true 33 | false 34 | false 35 | MyAppInstaller_web 36 | MyAppInstaller_mcr 37 | MyAppInstaller_app 38 | true 39 | false 40 | 41 | false 42 | false 43 | 44 | Syntax 45 | -? 46 | 47 | Input Arguments 48 | -? print help on how to use the application 49 | input arguments 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | D:\GitHub\MATLABIntegrationWithC\M_MEX_project\Filter_Design.mlapp 79 | 80 | 81 | 82 | 83 | D:\GitHub\MATLABIntegrationWithC\M_MEX_project\filter_bode.m 84 | 85 | 86 | D:\GitHub\MATLABIntegrationWithC\M_MEX_project\Deployment\for_testing\FilterDesign.exe 87 | D:\GitHub\MATLABIntegrationWithC\M_MEX_project\Deployment\for_testing\readme.txt 88 | D:\GitHub\MATLABIntegrationWithC\M_MEX_project\Deployment\for_testing\splash.png 89 | 90 | 91 | 92 | C:\Program Files\MATLAB\R2024a 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | true 104 | 105 | 106 | 107 | 108 | true 109 | 110 | 111 | 112 | 113 | true 114 | 115 | 116 | 117 | 118 | true 119 | 120 | 121 | 122 | 123 | true 124 | 125 | 126 | 127 | 128 | true 129 | 130 | 131 | 132 | 133 | false 134 | false 135 | true 136 | false 137 | false 138 | false 139 | false 140 | false 141 | 10.0 142 | false 143 | true 144 | win64 145 | true 146 | 147 | 148 | -------------------------------------------------------------------------------- /M_MEX_project/Deployment/FilterDesignWebApp.prj: -------------------------------------------------------------------------------- 1 | 2 | 3 | FilterDesign 4 | ${PROJECT_ROOT}\FilterDesignWebApp 5 | ${PROJECT_ROOT}\FilterDesignWebApp 6 | 7 | false 8 | ${PROJECT_ROOT}\FilterDesignWebApp 9 | subtarget.web.app 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | D:\GitHub\MATLABIntegrationWithC\M_MEX_project\Filter_Design.mlapp 24 | 25 | 26 | 27 | D:\GitHub\MATLABIntegrationWithC\M_MEX_project\filter_bode.m 28 | 29 | 30 | 31 | D:\GitHub\MATLABIntegrationWithC\M_MEX_project\Deployment\FilterDesignWebApp\FilterDesign.ctf 32 | 33 | 34 | 35 | C:\Program Files\MATLAB\R2024a 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | true 47 | 48 | 49 | 50 | 51 | true 52 | 53 | 54 | 55 | 56 | true 57 | 58 | 59 | 60 | 61 | true 62 | 63 | 64 | 65 | 66 | true 67 | 68 | 69 | 70 | 71 | true 72 | 73 | 74 | 75 | 76 | false 77 | false 78 | true 79 | false 80 | false 81 | false 82 | false 83 | false 84 | 10.0 85 | false 86 | true 87 | win64 88 | true 89 | 90 | 91 | -------------------------------------------------------------------------------- /M_MEX_project/Deployment/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/M_MEX_project/Deployment/favicon.png -------------------------------------------------------------------------------- /M_MEX_project/Deployment/splash_screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/M_MEX_project/Deployment/splash_screen.png -------------------------------------------------------------------------------- /M_MEX_project/Filter_Design.mlapp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/M_MEX_project/Filter_Design.mlapp -------------------------------------------------------------------------------- /M_MEX_project/check_num_input.m: -------------------------------------------------------------------------------- 1 | function param = check_num_input(param,limits,text_id) 2 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3 | % Function: check_num_input() 4 | % Goal : Checks a numerical input parameter given by the user 5 | % 6 | % IN : - limits : boundaries allowed for the desired parameter 7 | % - text_id: text to display related to the desired parameter 8 | % IN/OUT : - param : parameter to set via the user interface 9 | % OUT : - 10 | % 11 | % Copyright 2024 The MathWorks, Inc. 12 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 13 | %#codegen 14 | % Functions that are not translated into C code 15 | coder.extrinsic('input','num2str'); 16 | 17 | ERROR_MESSAGE_1 = 'For this filter, the parameter should be between '; 18 | ERROR_MESSAGE_2 = 'The value provided is not of the right data type.'; 19 | ERROR_MESSAGE_3 = 'Please, enter a correct value.'; 20 | 21 | % Loop to get and validate user's input 22 | while(1) 23 | param_str = input(text_id,'s'); 24 | param = str2double(param_str); 25 | if ~isnan(param) 26 | if (param >= limits(1) && param <= limits(2)) 27 | % The parameter stands into the correct range 28 | break; 29 | else 30 | disp([ERROR_MESSAGE_1,num2str(limits(1)),' and ',num2str(limits(2)),'. ']); 31 | disp(ERROR_MESSAGE_3); 32 | end 33 | else 34 | disp(ERROR_MESSAGE_2); 35 | disp(ERROR_MESSAGE_3); 36 | end 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /M_MEX_project/check_str_input.m: -------------------------------------------------------------------------------- 1 | function param = check_str_input(text_id) 2 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3 | % Function: check_str_input() 4 | % Goal : Checks string input parameter given by the user 5 | % 6 | % IN : - text_id : text to display related to the desired parameter 7 | % IN/OUT : - 8 | % OUT : - 9 | % 10 | % Copyright 2024 The MathWorks, Inc. 11 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 12 | %#codegen 13 | % Functions that are not translated into C code 14 | coder.extrinsic('input'); 15 | 16 | ERROR_MESSAGE = 'Unknown filter type. Please, enter a correct one.'; 17 | FILTER = ['low ';'high';'band';'stop']; 18 | NB_FILTERS = 4; 19 | % Initialization 20 | boolean = false; 21 | 22 | % Loop to get and validate user's input 23 | while(1) 24 | param_str = input(text_id,'s'); 25 | % Handling of special strings 26 | if (strcmp(param_str,'low')) 27 | param_str = [param_str,' ']; %#ok 28 | end 29 | % Compare the entry to the available types 30 | for i=1:1:NB_FILTERS 31 | boolean = strcmp(param_str,FILTER(i,:)); 32 | if (boolean == true) 33 | break; % No need to go on with the FOR loop 34 | end 35 | end 36 | if (boolean == true) 37 | break; % Leave the WHILE loop because one type matches the entry 38 | else 39 | % No right type selected 40 | disp(ERROR_MESSAGE); 41 | end 42 | end 43 | param = param_str; 44 | end 45 | -------------------------------------------------------------------------------- /M_MEX_project/check_yes_or_no.m: -------------------------------------------------------------------------------- 1 | function param = check_yes_or_no(text_id) 2 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3 | % Function: check_yes_or_no() 4 | % Goal : Checks if the given parameter is either 'yes' or 'no' 5 | % 6 | % IN : - text_id: text to display related to the desired parameter 7 | % IN/OUT : - 8 | % OUT : - param : parameter to set via the user interface 9 | % 10 | % Copyright 2024 The MathWorks, Inc. 11 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 12 | %#codegen 13 | % Functions that are not translated into C code 14 | coder.extrinsic('input'); 15 | 16 | ERROR_MESSAGE = 'Please, enter [y,Y] for YES or [n,N] for NO.'; 17 | N_CHAR = 'n'; 18 | Y_CHAR = 'y'; 19 | % Loop to get and validate user's input 20 | while(1) 21 | % Ask the user to enter a selection 22 | param = input(text_id,'s'); 23 | if (strcmpi(param,Y_CHAR) || strcmpi(param,N_CHAR)) 24 | break; 25 | else 26 | disp(ERROR_MESSAGE); 27 | end 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /M_MEX_project/filter_bode.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/M_MEX_project/filter_bode.m -------------------------------------------------------------------------------- /M_MEX_project/filter_bode_mex.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/M_MEX_project/filter_bode_mex.mexw64 -------------------------------------------------------------------------------- /M_MEX_project/main.m: -------------------------------------------------------------------------------- 1 | function error_flag = main() 2 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3 | % Function: main() 4 | % Goal : Main C function of the executable 5 | % 6 | % IN : - 7 | % IN/OUT : - 8 | % OUT : - 9 | % 10 | % Copyright 2024 The MathWorks, Inc. 11 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 12 | %#codegen 13 | % Functions that are not translated into C code 14 | coder.extrinsic('plot_filter'); 15 | 16 | % Constants 17 | SEPARATOR = '--------------------------------------------------------------------------------'; 18 | TITLE = '--------------------------- FILTER DESIGN AND VIEWER ---------------------------'; 19 | FILTER_TYPE = 'Type of filter [low][high][band][stop]: '; 20 | FILTER_ORDER = 'Order of the filter: '; 21 | CUTOFF_FREQ = 'Cutoff frequency: '; 22 | QUALITY_FAC = 'Quality factor: '; 23 | LINEAR_GAIN = 'Linear gain of the filter: '; 24 | BAND_FILTER = 'band'; 25 | STOP_FILTER = 'stop'; 26 | N_CHAR = 'n'; 27 | PREV_BODES = 'Do you want to keep the previous Bodes [y,n]? '; 28 | OTHER_BODES = 'Do you want to see Bodes of another filter [y,n]? '; 29 | ERROR_TEXT = 'Bodes cannot be maid due to a misconfiguration of parameters.'; 30 | ERROR_T_TEXT = 'This type of filter is not supported.'; 31 | ERROR_N_TEXT = 'This order value is not supported for such filters. It must be an even value.'; 32 | ERROR_U_TEXT = 'Unknown error. Please re-submit filter''s parameters.'; 33 | ERROR_TYPE = int32(1); 34 | ERROR_ORDER = int32(2); 35 | 36 | % Initialization 37 | error_flag = int32(0); 38 | f_t = char(zeros(1,4)); %#ok 39 | n_f = 0; 40 | f_0 = 0; 41 | q_0 = 0; 42 | g = 1; 43 | fig_id = 0; 44 | 45 | % Definition of the logarithmic frequency range till 1 Giga Hertz 46 | power_f_min = 0; power_f_max = 9; nb_pts = 1e005; 47 | f = logspace(power_f_min,power_f_max,nb_pts); 48 | % Program title 49 | disp(SEPARATOR); 50 | disp(TITLE); 51 | disp(SEPARATOR); 52 | % Forever loop 53 | while(1) 54 | % Ask for filter's parameters 55 | f_t = check_str_input(FILTER_TYPE); 56 | if (strcmp(f_t,BAND_FILTER) || strcmp(f_t,STOP_FILTER)) 57 | n_f = check_num_input(n_f,[2 10],FILTER_ORDER); 58 | else 59 | n_f = check_num_input(n_f,[1 10],FILTER_ORDER); 60 | end 61 | f_0 = check_num_input(f_0,[10^power_f_min,10^power_f_max],CUTOFF_FREQ); 62 | if (n_f > 1) 63 | q_0 = check_num_input(q_0,[0.1 10],QUALITY_FAC); 64 | end 65 | g = check_num_input(g,[0.001,1000],LINEAR_GAIN); 66 | 67 | % Bodes calculation 68 | [H_mod,H_arg,error_flag] = filter_bode(f,f_0,q_0,g,f_t,n_f); 69 | % Display of results (target dependent) 70 | if (error_flag == 0) 71 | fig_id = fig_id+1; 72 | plot_filter(f,H_mod,H_arg,f_t,n_f,fig_id); 73 | else % An error occured and bodes cannot be plotted 74 | disp(ERROR_TEXT); 75 | switch (error_flag) 76 | case ERROR_TYPE 77 | disp(ERROR_T_TEXT); 78 | case ERROR_ORDER 79 | disp(ERROR_N_TEXT); 80 | otherwise 81 | disp(ERROR_U_TEXT); 82 | end 83 | end 84 | 85 | % Ask the user if he wants to keep the previous graphs 86 | keep_bodes = check_yes_or_no(PREV_BODES); 87 | if (strcmpi(keep_bodes,N_CHAR)) 88 | close all; 89 | end 90 | % Ask the user if he wants to see other filter's Bodes 91 | new_bodes = check_yes_or_no(OTHER_BODES); 92 | if (strcmpi(new_bodes,N_CHAR)) 93 | break; 94 | end 95 | disp(SEPARATOR); 96 | end 97 | end 98 | -------------------------------------------------------------------------------- /M_MEX_project/main_mex.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/M_MEX_project/main_mex.mexw64 -------------------------------------------------------------------------------- /M_MEX_project/plot_filter.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/M_MEX_project/plot_filter.m -------------------------------------------------------------------------------- /M_MEX_project/test_filter_bode.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Goal : Test of the filter_bode() and filter_bode_mex() functions 3 | % Copyright 2024 The MathWorks, Inc. 4 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5 | clear variables; close all; clc; 6 | 7 | % Filters definitions 8 | f = (1:10:1e006); 9 | f_0 = [1e003,1e003,1e003,1e003,1e003,1e003,1e003,1e003]; 10 | q_0 = [0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5]; 11 | g = [1,10,10,100,1,1,10,100]; 12 | type = char('low','high','low','high','band','stop','test','band'); 13 | order = int32([1,1,2,2,2,2,1,3]); 14 | % Initialization 15 | nb_filter = length(order); 16 | nb_frequs = length(f); 17 | H_mod = zeros(nb_filter,nb_frequs); 18 | H_mod_mex = zeros(nb_filter,nb_frequs); 19 | H_arg = zeros(nb_filter,nb_frequs); 20 | H_arg_mex = zeros(nb_filter,nb_frequs); 21 | error_flag = zeros(1,nb_filter); 22 | error_flag_mex = zeros(1,nb_filter); 23 | disp('Initialization done.'); 24 | 25 | % Define the configuration object for the MEX file to generate 26 | cfg = coder.config('mex'); 27 | cfg.FilePartitionMethod = 'SingleFile'; 28 | % MEX file generation 29 | codegen filter_bode -launchreport -config cfg -args {zeros(1,1e005),0,0,0,char(zeros(1,4)),int32(0)} 30 | disp('MEX generated successfully.'); 31 | 32 | % Bodes calculation 33 | for i=1:1:nb_filter 34 | [H_mod(i,:),H_arg(i,:),error_flag(i)] = ... 35 | filter_bode(f,f_0(i),q_0(i),g(i),char(type(i,:)),order(i)); 36 | [H_mod_mex(i,:),H_arg_mex(i,:),error_flag_mex(i)] = ... 37 | filter_bode_mex(f,f_0(i),q_0(i),g(i),char(type(i,:)),order(i)); 38 | end 39 | disp('Bodes calculation done.'); 40 | 41 | % Display of results in reverse order to have the first filter at first 42 | for i=nb_filter:-1:1 43 | if (error_flag(i) == 0) 44 | plot_filter(f,H_mod(i,:),H_arg(i,:),char(type(i,:)),order(i),i); 45 | else 46 | disp(['MAT, the following error occured: ' num2str(error_flag(i))]); 47 | end 48 | if (error_flag_mex(i) == 0) 49 | plot_filter(f,H_mod_mex(i,:),H_arg_mex(i,:),char(type(i,:)),order(i),i); 50 | else 51 | disp(['MEX, the following error occured: ' num2str(error_flag_mex(i))]); 52 | end 53 | end 54 | disp('Bodes plots done.'); 55 | 56 | % Check if differences exist between the MATLAB and MEX vectors 57 | diff_mod = sum(abs(H_mod - H_mod_mex),2); 58 | diff_arg = sum(abs(H_arg - H_arg_mex),2); 59 | disp('Differences between the MATLAB and MEX Bodes:'); 60 | disp(['Module => ' num2str(diff_mod')]); 61 | disp(['Angle => ' num2str(diff_arg')]); 62 | -------------------------------------------------------------------------------- /M_MEX_project/test_main.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Goal : Test of the main() and main_mex() functions 3 | % Copyright 2024 The MathWorks, Inc. 4 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5 | clear variables; close all; clc; 6 | 7 | % Test the MEX file if set to '1' 8 | TEST_MEX = 0; 9 | if (TEST_MEX == 0) 10 | % Call of the standard MATLAB code 11 | error_flag = main(); 12 | else 13 | % Generate the MEX function of the main file 14 | disp('Building the MEX file, please wait...'); 15 | codegen('main'); 16 | disp('The MEX file has been built successfully.'); 17 | % Call of the MEX function 18 | error_flag = main_mex(); 19 | end 20 | 21 | % Execution status 22 | disp(['The system has returned with the error status: ',num2str(error_flag)]); 23 | -------------------------------------------------------------------------------- /_Documents/Filter_Design_C_Codegen_and_Deployment.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/_Documents/Filter_Design_C_Codegen_and_Deployment.pdf -------------------------------------------------------------------------------- /_Documents/Readme.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/MATLAB_Integration_with_C/fb3761af7a0c8d38fa81c88b105fc9dace1073c3/_Documents/Readme.pdf -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018, The MathWorks, Inc. 2 | All rights reserved. 3 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 4 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 5 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 6 | 3. In all cases, the software is, and all modifications and derivatives of the software shall be, licensed to you solely for use in conjunction with MathWorks products and service offerings. 7 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 8 | 9 | --------------------------------------------------------------------------------