Skip to content

Commit

Permalink
Add setting to customize axis starting value on mouse+keyboard entry …
Browse files Browse the repository at this point in the history
…and also validate axis numbers input
  • Loading branch information
jmgirard committed Oct 23, 2019
1 parent d1722ea commit 856bd13
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 19 deletions.
54 changes: 44 additions & 10 deletions CARMA.prj
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<deployment-project plugin="plugin.ezdeploy" plugin-version="1.0">
<configuration file="C:\Users\jgirard\Documents\CARMA\CARMA.prj" location="C:\Users\jgirard\Documents\CARMA" name="CARMA" target="target.ezdeploy.standalone" target-name="Application Compiler">
<configuration file="D:\GitHub\CARMA\CARMA.prj" location="D:\GitHub\CARMA" name="CARMA" target="target.ezdeploy.standalone" target-name="Application Compiler">
<param.appname>CARMA</param.appname>
<param.icon />
<param.icons />
<param.version>14.03</param.version>
<param.authnamewatermark>Jeffrey M Girard</param.authnamewatermark>
<param.email>[email protected]</param.email>
<param.version>14.04</param.version>
<param.authnamewatermark />
<param.email />
<param.company />
<param.summary>CARMA: Software for Continuous Affect Rating and Media Annotation</param.summary>
<param.description>Source files, releases, documentation, and support are available through http://carma.jmgirard.com</param.description>
Expand Down Expand Up @@ -36,7 +36,12 @@
<param.native.matlab>false</param.native.matlab>
<param.checkbox>false</param.checkbox>
<param.example />
<param.help.text />
<param.help.text>Syntax
-?

Input Arguments
-? print help on how to use the application
input arguments</param.help.text>
<unset>
<param.icon />
<param.icons />
Expand Down Expand Up @@ -69,7 +74,6 @@
<param.native.matlab />
<param.checkbox />
<param.example />
<param.help.text />
</unset>
<fileset.main>
<file>${PROJECT_ROOT}\fig_launcher.m</file>
Expand All @@ -92,21 +96,51 @@
<file>${PROJECT_ROOT}\fig_collect_vrjoy.m</file>
</fileset.depfun>
<build-deliverables>
<file location="${PROJECT_ROOT}\CARMA\for_testing" name="splash.png" optional="false">C:\Users\jgirard\Documents\CARMA\CARMA\for_testing\splash.png</file>
<file location="${PROJECT_ROOT}\CARMA\for_testing" name="CARMA.exe" optional="false">C:\Users\jgirard\Documents\CARMA\CARMA\for_testing\CARMA.exe</file>
<file location="${PROJECT_ROOT}\CARMA\for_testing" name="readme.txt" optional="true">C:\Users\jgirard\Documents\CARMA\CARMA\for_testing\readme.txt</file>
<file location="${PROJECT_ROOT}\CARMA\for_testing" name="readme.txt" optional="true">D:\GitHub\CARMA\CARMA\for_testing\readme.txt</file>
<file location="${PROJECT_ROOT}\CARMA\for_testing" name="CARMA.exe" optional="false">D:\GitHub\CARMA\CARMA\for_testing\CARMA.exe</file>
<file location="${PROJECT_ROOT}\CARMA\for_testing" name="splash.png" optional="false">D:\GitHub\CARMA\CARMA\for_testing\splash.png</file>
</build-deliverables>
<workflow />
<matlab>
<root>C:\Program Files\MATLAB\R2018a</root>
<root>D:\MATLAB</root>
<toolboxes>
<toolbox name="matlabcoder" />
<toolbox name="embeddedcoder" />
<toolbox name="gpucoder" />
<toolbox name="fixedpoint" />
<toolbox name="matlabhdlcoder" />
<toolbox name="neuralnetwork" />
</toolboxes>
<toolbox>
<matlabcoder>
<enabled>true</enabled>
</matlabcoder>
</toolbox>
<toolbox>
<embeddedcoder>
<enabled>true</enabled>
</embeddedcoder>
</toolbox>
<toolbox>
<gpucoder>
<enabled>true</enabled>
</gpucoder>
</toolbox>
<toolbox>
<fixedpoint>
<enabled>true</enabled>
</fixedpoint>
</toolbox>
<toolbox>
<matlabhdlcoder>
<enabled>true</enabled>
</matlabhdlcoder>
</toolbox>
<toolbox>
<neuralnetwork>
<enabled>true</enabled>
</neuralnetwork>
</toolbox>
</matlab>
<platform>
<unix>false</unix>
Expand Down
34 changes: 28 additions & 6 deletions fig_collect_mouse.m
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@
set(handles.text_upper,'String',handles.settings.labUpper);
axMin = handles.settings.axMin;
axMax = handles.settings.axMax;
axMidpt = axMin + (axMax - axMin)/2;
axStart = handles.settings.axStart;
set(handles.slider, ...
'SliderStep',[1/40,1/20], ...
'Min',axMin,'Max',axMax,'Value',axMidpt);
'Min',axMin,'Max',axMax,'Value',axStart);
% Initialize rating axis
axes(handles.axis_rating);
set(handles.axis_rating,'XLim',[0,100],'YLim',[0,100]);
Expand Down Expand Up @@ -282,18 +282,40 @@ function menu_axislab_Callback(hObject,~)
function menu_axisnum_Callback(hObject,~)
handles = guidata(hObject);
settings = handles.settings;
prompt = {'Axis Minimum Value:','Axis Maximum Value:','Number of Axis Steps:'};
defaultans = {num2str(settings.axMin),num2str(settings.axMax),num2str(settings.axSteps)};
prompt = {'Axis Minimum Value:','Axis Maximum Value:','Number of Axis Steps:','Axis Starting Value:'};
defaultans = {num2str(settings.axMin),num2str(settings.axMax),num2str(settings.axSteps),num2str(settings.axStart)};
numbers = inputdlg(prompt,'',1,defaultans);
if ~isempty(numbers)
settings.axMin = str2double(numbers{1});
settings.axMax = str2double(numbers{2});
settings.axSteps = str2double(numbers{3});
settings.axStart = str2double(numbers{4});
if any(isnan([settings.axMin, settings.axMax, settings.axSteps, settings.axStart]))
warndlg('All values must be entered as numbers.', 'Warning');
return;
end
if settings.axMax <= settings.axMin
warndlg('Axis Maximum Value must be greater than Axis Minimum Value.', 'Warning');
return;
end
if settings.axMax <= settings.axMin
warndlg('Axis Maximum Value must be greater than Axis Minimum Value.', 'Warning');
return;
end
if settings.axStart < settings.axMin || settings.axStart > settings.axMax
warndlg('Axis Start must be between then Axis Minimum and Axis Maximum Values.', 'Warning');
return;
end
set(handles.axis_rating, ...
'YLim',[settings.axMin,settings.axMax], ...
'YTick',round(linspace(settings.axMin,settings.axMax,settings.axSteps),2));
set(handles.plot_patch,'YData',[settings.axMin settings.axMin settings.axMax settings.axMax]);
setpref('carma',{'axMin','axMax','axSteps'},{settings.axMin,settings.axMax,settings.axSteps});
set(handles.slider, ...
'SliderStep',[1/40,1/20], ...
'Min',settings.axMin, ...
'Max',settings.axMax, ...
'Value',settings.axStart);
setpref('carma',{'axMin','axMax','axSteps','axStart'},{settings.axMin,settings.axMax,settings.axSteps,settings.axStart});
handles.settings = settings;
guidata(handles.figure_collect,handles);
end
Expand Down Expand Up @@ -442,7 +464,7 @@ function menu_defaultdir_Callback(hObject,~)

function menu_about_Callback(~,~)
global version;
msgbox(sprintf('CARMA version %.2f\nJeffrey M Girard (c) 2014-2018\nhttp://carma.jmgirard.com\nGNU General Public License v3',version),'About','Help');
msgbox(sprintf('CARMA version %.2f\nJeffrey M Girard (c) 2014-2019\nhttp://carma.jmgirard.com\nGNU General Public License v3',version),'About','Help');
end

% ===============================================================================
Expand Down
12 changes: 12 additions & 0 deletions fig_collect_vrjoy.m
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,18 @@ function menu_axisnum_Callback(hObject,~)
settings.axMin = str2double(numbers{1});
settings.axMax = str2double(numbers{2});
settings.axSteps = str2double(numbers{3});
if any(isnan([settings.axMin, settings.axMax, settings.axSteps]))
warndlg('All values must be entered as numbers.', 'Warning');
return;
end
if settings.axMax <= settings.axMin
warndlg('Axis Maximum Value must be greater than Axis Minimum Value.', 'Warning');
return;
end
if settings.axMax <= settings.axMin
warndlg('Axis Maximum Value must be greater than Axis Minimum Value.', 'Warning');
return;
end
set(handles.axis_rating, ...
'YLim',[settings.axMin,settings.axMax], ...
'YTick',round(linspace(settings.axMin,settings.axMax,settings.axSteps),2));
Expand Down
6 changes: 3 additions & 3 deletions fig_launcher.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
% License: https://github.com/jmgirard/CARMA/blob/master/license.txt

global version;
version = 14.03;
version = 14.04;
% Create and center main window
defaultBackground = get(0,'defaultUicontrolBackgroundColor');
handles.figure_launcher = figure( ...
Expand Down Expand Up @@ -60,8 +60,8 @@
pExist = ispref('carma');
if ~pExist
addpref('carma', ...
{'labLower','labUpper','axMin','axMax','axSteps','cmapval','cmapstr','defdir','srateval','sratenum','bsizeval','bsizenum','update'}, ...
{'Negative Affect','Positive Affect',-100,100,9,1,'parula','',2,20,3,1.00,'ask'});
{'labLower','labUpper','axMin','axMax','axSteps','axStart','cmapval','cmapstr','defdir','srateval','sratenum','bsizeval','bsizenum','update'}, ...
{'Negative Affect','Positive Affect',-100,100,9,0,1,'parula','',2,20,3,1.00,'ask'});
end
% Check for updates
try
Expand Down

0 comments on commit 856bd13

Please sign in to comment.