How to use num2str?

3 ビュー (過去 30 日間)
Veronika
Veronika 2014 年 11 月 17 日
回答済み: Azzi Abdelmalek 2014 年 11 月 17 日
Dear all, I have this part of code:
R = [0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1] % vector, which data saves from the for loop
for i = 1:numel (R)
j = R(i);
[('x' -num2str(j)).^2+ '(y-0.5).^2<0.1^2','x','y','z'];
select_fcn = inline('(x-j).^2+(y-0.5).^2<0.1^2','x','y','z');
img_2.elem_data = 1 +* elem_select(img_2.fwd_model, select_fcn);
output(i)= Q;
end
I try to change variable j (for example j = 0.1).
But this line: [('x' -num2str(j)).^2+ '(y-0.5).^2<0.1^2','x','y','z'] ; report an error (Error using + Matrix dimensions must agree.).
Does anybody know what´s wrong?
Thank you for your answers.

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 11 月 17 日
['x-' num2str(j) '.^2+ (y-0.5).^2<0.1^2,' 'x,' 'y,' 'z'];

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by