필터 지우기
필터 지우기

How to multiply 2 columns by a scalar number in MATLAB

조회 수: 3 (최근 30일)
Muhammad
Muhammad 2013년 9월 19일
Dear All
Hope you all are keeping good.i need 4 columns [X,Y,Z,Volume]in excel and first of all i want to multiply X and Y columns by 0.09 and (Z column contains just one scalar (0.18) value) then want to multiply all these X,Y,Z coordinates to get Volume. the code i am trying is given below. any help is appreciated.
if true
[x, y] = find(handles.maskedImage ~= 0);
% here x and y are created in excel by code line.to calculate the volume. first multiply 0.09 by both columns to get X and Y.
X=times(0.09,x);
Y=times(0.09,y);
Z = repmat(0.18,[length(x),1]);
[FileName,PathName] = uiputfile('*.xls','Save data to spreadsheet');
Volume=times(X,Y,Z);
Data=[X,Y,Z, Volume];
xlswrite([PathName '/' FileName],Data); end
  댓글 수: 3
Muhammad
Muhammad 2013년 9월 19일
yes, it works thank you.
Image Analyst
Image Analyst 2013년 9월 19일
편집: Image Analyst 2013년 9월 19일
No it doesn't. Think about what you are doing. Multiplying the x,y coordinates of every pixel in the selected region by the spatial calibration factor does not calculate the volume.

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

채택된 답변

Jan
Jan 2013년 9월 19일
X = 0.09 * x;
Y = 0.09 * y;
Volume = X .* Y * 0.18;
  댓글 수: 3
Jan
Jan 2013년 9월 20일
@Image Analyst: I'm physicist and therefore very free in the choice of the definition of the term "volume", "pixel" and "coordinates". It could be a sound volume for a generalization of acoustic sound waves in a high-dimensional space with a linear metric. Or the coordinates could have been transformed before by a difference of neighboring elements.
But without doubt you are right and for the standard definition of a spatial volume in the Euclidean 3D space this calculations are not correct.
@Muhammad: You have to check the results with known test data, e.g. a line (Volume==0), a sphere and a rotated cube. I focused on avoiding the failing times().
Muhammad
Muhammad 2013년 9월 24일
편집: Muhammad 2013년 9월 24일
ok yes, i understand. listen what i want.
i want to make GUI it will work as we contour some region of interest in the patient CT in Pinnacle treatment planning system and then calculate the dose and find mean,minimum, maximum dose in that region.
But i have a image file and a dose file. i want to use these to calculate the maximum, minimum, and mean doses inside the contour region.i want to make contoure in the image and use that in dose to find the dose in that region and calculate maximum, minimum, and mean dose in that region.
till now, i made a GUI i can open a image (there are 55 image Slices, i can open one at a time) on the axis then i can contour by imfreehand. i thoght if i have the all x,y cooridnates inside the region then i will find these coordinate in the dose file which is in excel for the same slice to calculate the mean maximum doses but it vain

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Processing and Computer Vision에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by