How do I save a workspace data to a specific directory.

31 次查看(过去 30 天)
I want to save the mean image matrix(Back_m) into a following folder 'C:\Users\YJ\Desktop\matlab' Here is what I did
clc;
clear;
back_path = 'F:\Thesis data\sample\datachris\Intensifier_Off\';
back_files = dir([back_path '*.im7']);
n_back=length(back_files);
n_im=length(back_files);
A1 = readimx([back_path back_files(1).name]);
% All_back_data = zeros(A1.Nx,A1.Ny*A1.Nf,n_im);
All_back_data = zeros(A1.Nx,A1.Ny*A1.Nf,n_im);
for i = 1:n_im
temp = readimx([back_path back_files(i).name]);
All_back_data(:,:,i) = double(temp.Data);
end
Back_m = mean(All_back_data);
figure;imshow(temp.Data(:,1:768),[]);colormap jet;colorbar
savdir = 'C:\Users\YJ\Desktop\matlab\';
save(fullfile(savdir,Back_m),'backmean');
And I get the following result:
Error using fullfile (line 59) Char inputs with multiple rows are not supported.

采纳的回答

Guillaume
Guillaume 2014-9-19
编辑:Guillaume 2014-9-19
You got confused over the name of the file and the name of the variable, it should be:
save(fullfile(savedir, 'backmean'), 'Back_m'); %maybe also add extension to backmean

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 File Name Construction 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by