Help with division on a cell array

조회 수: 2 (최근 30일)
Ian
Ian 2013년 2월 28일
Hello,
I was wondering if anyone could help me with a simple question please. I'm trying to create a system where the user enters a number. The value of total_no_images is a 1x1 cell and I want to carry out general easy multiplication and division on it using / and * and I've tried ./ and .* but am having no luck. Also played with cell2mat etc functions but no luck. anyone have any ideas? I don't think its that hard im just new to this!
Many thanks
% Displays modal dialogue box with requested parameters and allows answer to
%be inputted and saved to workspace variable
total_no_images =inputdlg(prompt,title_figure,num_lines,def,options);
%Display messages to user
fprintf('Total Number of images to capture =\n');
disp(total_no_images);
%Display required angle between each image
angle = 360./total_no_images

채택된 답변

Image Analyst
Image Analyst 2013년 2월 28일
Try this:
prompt = 'Enter number';
title = 'Enter an integer';
title_figure = 'my title';
def = {'20'};
num_lines = 1;
total_no_images =inputdlg(prompt,title_figure,num_lines,def);
total_no_images = str2num(total_no_images{1})
%Display messages to user
fprintf('Total Number of images to capture = %d\n', total_no_images);
%Display required angle between each image
angle = 360./total_no_images
  댓글 수: 1
Ian
Ian 2013년 2월 28일
Perfect, thank you so much!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by