フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

How do I convert the matlab frames I've generated in the program below to tiff format

1 回表示 (過去 30 日間)
EngStudent
EngStudent 2013 年 1 月 28 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I have developed a program that shows the movement of a circle along the plotted points frame by frame, I found a function that could help me convert the frames to tiff format from http://www.mathworks.com/matlabcentral/fileexchange/23629-exportfig but every time I call the function the program stops generating the frames and I get this error message. Please I really need your help. Thank you
??? Undefined function or method 'print2array' for input arguments of type 'double'.
Error in ==> export_fig at 331 [A, tcol] = print2array(fig, magnify, renderer);
Error in ==> calibrationtweezers_1 at 59 export_fig stack.tif
y_max=50.0;
y_min=-50.0;
%F= (rand(20,10).*10);
N=300;
RandForce = 1030*rand(N,1) .* sign(randn(N,1));% random positions
k= 20.5;
y=RandForce./k;
%r=x_min+(x_max-x_min).*rand(n,1);
y(y_min > y | y > y_max) = 0;
figure (1)
plot(y); % Graphs the Plot
xlabel('frames'); ylabel('Random Positions');
hold on
figure (2)
scatter(1:length(y), y, 90, [0 0 0], 'filled' );
xlabel('frames');
ylabel('Random Positions');
figure('Position', [300 300 300 300])
axlim=10000;
aylim=10000;
for i = 1:length(y)
%fprintf('Frame: %03d\n', i)
b=y
a=2;
plot(a,b,'.','MarkerSize',60)
axis([-axlim axlim -aylim aylim]);
% axis off
end
%aviobj = avifile('microsphere.avi','compression','None');
randommov = figure('Position', [300 300 300 300])
h=randommov;
set(h,'Position',[300 300 300 300])
set(h,'NextPlot','replacechildren')%Make sure each frame
%of the movie is the same size
axlim=10000;
aylim=10000;
N=30;
count=1;
M=moviein(N);
for j = 1:1:N
%fprintf('Frame: %03d\n', i)
b=y;
figure('Position', [300 300 300 300])
plot(a,b(j),'.','MarkerSize',100)
axis([-axlim axlim -aylim aylim]);
title('Microsphere');
S1=sprintf('Frame: %03d\n', j);
text(6,.5,S1)
pause(0.001);
% axis off
M(:,j) = getframe(randommov);
M(count)=getframe(h);
count=count+1;
if j==1
export_fig stack.tif
else
export_fig stack.tif -append
end
end
  1 件のコメント
Image Analyst
Image Analyst 2013 年 1 月 28 日
編集済み: Image Analyst 2013 年 1 月 28 日
Edit your post. Put a blank line before your code. Highlight your code. Click the {}Code icon, then save it. This will format your code nicely. Are you going to make us guess at your error message? Why not make it easy for us to help you and tell us what the error message is?

回答 (2 件)

Image Analyst
Image Analyst 2013 年 1 月 28 日
I copied and pasted your code. The error message I get, right before you try to call imwrite() is:
Undefined function or variable 'c'.
Error in test (line 80)
if c == 1
So, what is c?
  10 件のコメント
EngStudent
EngStudent 2013 年 2 月 1 日
編集済み: EngStudent 2013 年 2 月 1 日
I keep getting this message after putting the file name in quotes
??? Undefined function or method 'print2array' for input arguments of type 'double'.
Error in ==> export_fig at 331 [A, tcol] = print2array(fig, magnify, renderer);
Error in ==> calibrationtweezers_1 at 60 export_fig 'stack.tif'; MathWorks
EngStudent
EngStudent 2013 年 2 月 1 日
I was wondering if I needed to save all functions in from this website http://www.mathworks.com/matlabcentral/fileexchange/23629-exportfig In order to convert the frames to tiff or do just needed to save export_fig
I got this error after running the program a second time ??? Error using ==> imwrite at 457 Can't open file "stack.tif" for writing. You may not have write permission.
Error in ==> export_fig at 388 imwrite(A, [options.name '.tif'], 'Resolution', options.magnify*get(0, 'ScreenPixelsPerInch'), 'WriteMode', append_mode{options.append+1});
Error in ==> calibrationtweezers_1 at 60 export_fig 'stack.tif'

Walter Roberson
Walter Roberson 2013 年 1 月 28 日
What directory are you in when you execute this code? If you are in a directory MATLAB is installed in, the directory is likely protected by the operating system.
  5 件のコメント
Walter Roberson
Walter Roberson 2013 年 1 月 28 日
Is there an existing tiffstack.tiff file in that directory? If so then delete it and try again.
EngStudent
EngStudent 2013 年 1 月 29 日
I don't have any existing tiff files in my directory

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by