from Read and Write Values from and to the Registry using Matlab by Uri Kartoun
Read and Write Values from and to the Registry using Matlab

Matlab_Write_Registry.m
% Write Values to the Registry using Matlab

% By Uri Kartoun at kartoun@yahoo.com

% Please visit: http://www.compactech.com/kartoun

Local_Directory='G:\Temp\write_reg.reg';

Dir1 = '[HKEY_CURRENT_USER\Matlab\Key1]';

Variable_Name = input('Variable name: ','s')

Var = input('Value to write to registry: ','s')

regFileName = Local_Directory;
fp = fopen(regFileName,'wt');
fprintf(fp,'REGEDIT4\n');
fprintf(fp,'%s\n',Dir1);
fprintf(fp,'%s%s%s%s%s%s\n','"', Variable_Name, '"=', '"', Var, '"' );
fclose(fp);
dos('C:\windows\regedit.exe /s G:\Temp\write_reg.reg');

Contact us at files@mathworks.com