これがあなたが探しているものの例です:
%# Generate the data
Measurement1 = {[0.33 0.23 0.34 -32.32]; [-132.3 32.1 32.23 -320.32]};
Measurement2 = {433.2; 3.2};
TextStuff = {'The cat who ate the rat'; 'The dog who ate the cat'};
s = cell2struct([Measurement1, Measurement2, TextStuff], ...
{'Measurement1', 'Measurement2', 'TextStuff'}, 2);
str_format = @(tag, value)sprintf('%s:%s', tag, value);
%# Iterate over the data and print it on the same figure
figure
for i = 1:length(s)
%# Clear the figure
clf, set(gcf, 'color', 'white'), axis off
%# Output the data
text(0, 1, str_format('Measurement1', num2str(s(i).Measurement1)));
text(0, 0.9, str_format('Measurement2', num2str(s(i).Measurement2)));
text(0, 0.8, str_format('TextStuff', s(i).TextStuff))
%# Wait until the uses press a key
pause
end
pause
次の反復が実行される前に、キーを押す必要があることに注意してください。各反復で図を見る機会を得られるように、そこに配置しました。
PSこの回答
(あなたの別の質問に対する)に
基づいて、LaTex方程式を出力することもできます。
編集-もう少し説明:
cell2struct
セル配列を構造体配列に変換する関数です。あなたの場合、、、がありMeasurement1
、それぞれが異なるフィールドに関するデータを保持するセル配列です。すべてのセル配列は、セル配列の
1つの配列に統合されます。各セル配列から各行を取得して構造体を形成し、その結果は次のように構造体の配列として格納されます。Measurement2
TextStuff
[Measurement1, Measurement2, TextStuff]
cell2struct
s =
2x1 struct array with fields:
Measurement1
Measurement2
TextStuff
を使用して最初の値のセットを抽出し、、を使用s(1)
して2番目の値のセットを抽出できますs(2)
。たとえば、s(1).TextStuff
あなたに与えます'The cat who ate the rat'
。
s
その内容を確認するには、MATLABコマンドプロンプトに入力することをお勧めします。
ヘルパー関数str_format
は、各フィールドの出力文字列をフォーマットするために作成した無名関数です。その入力引数はtag
(フィールド名文字列)とvalue
(フィールド値文字列)であり、C / C ++sprintf
の関数と同様に、コマンドを使用して連結されます。sprintf