MATLABで入力ダイアログボックスを作成しようとしていますが、既定の回答は以前の変換行列から呼び出す数値に基づいています。問題は、とは何か私は数字を文字列に変換できないことを意味します。つまり、数字をdefaultans
というプロパティとして呼び出すことはできません。 num2str
などの基本的な変換は、データが負の可能性があるため機能しません。 char
も動作していないようです。入力ダイアログのデフォルト回答として数値配列
earlierData = [ 1 -1.2 3 5 -0.2 4];
prompt = {'Enter x translation:', 'Enter y translation:', 'Enter z translation:', 'Enter x rotation:', 'Enter y rotation:', 'Enter z rotation:'};
name = 'Enter the values for the desired rotation matrix.';
num_lines = 1;
defaultans = [ox, oy, oz, oxrot, oyrot, ozrot];
nTransform = inputdlg(prompt, name, num_lines, defaultans);
newTranslate = [str2double(nTransform{1}) str2double(nTransform{2}) str2double(nTransform{3})];
nxrot = str2double(nTransform{4});
nyrot = str2double(nTransform{5});
nzrot = str2double(nTransform{6});
% make new transformation matrix
rot = makehgtform('translate', newTranslate, 'xrotate', nxrot,...
'yrotate', nyrot, 'zrotate', nzrot);
'負の数にだけで正常に動作しnum2str'。 – Suever