필터 지우기
필터 지우기

How to creating MAT file

조회 수: 1 (최근 30일)
Ivan Dwi Putra
Ivan Dwi Putra 2020년 10월 19일
댓글: Ivan Dwi Putra 2020년 10월 19일
This is my parameter
% Parameter Massa
m1 = 8095; % massa train set 1 dalam kg
m2 = 8500; % massa train set 2 dalam kg
m3 = 8457; % massa train set 3 dalam kg
% Parameter Gaya
f1 = 205.*10^3; % Gaya train set 1 dalam N
f2 = 302.*10^3; % Gaya train set 2 dalam N
f3 = 302.*10^3; % Gaya train set 3 dalam N
% Parameter Resistansi
c_0_1 = 0.01176;
c_1_1 = 0.00077616;
c_2_1 = 4.48 ;
c_0_2 = 0.01176 ;
c_1_2 = 0.00077616;
c_2_2 = 4.48;
c_0_3 = 0.01176 ;
c_1_3 = 0.00077616;
c_2_3 = 4.48;
% Desired Speed
v_0 = 300;
% Desired Train Following Headway Time
hstar = 120;
a_1 = -1./m1.*(c_1_1 + 2.*c_2_1.*v_0);
a_2 = -1./m2.*(c_1_2 + 2.*c_2_2.*v_0);
a_3 = -1./m3.*(c_1_3 + 2.*c_2_3.*v_0);
a_1_head = 1-(a_1.*hstar);
a_2_head = 1-(a_2.*hstar);
a_3_head = 1-(a_3.*hstar);
b = 1;
p_1 = -1./m1.*(c_0_1 - c_2_1.*(v_0).^2);
p_2 = -1./m2.*(c_0_2 - c_2_2.*(v_0).^2);
p_3 = -1./m3.*(c_0_3 - c_2_3.*(v_0).^2);
I want to save this parameter into MAT file extension
save valueparameters.mat
But it can't save it said permission denied
Error using save
Unable to write file valueparameters.mat: permission denied.
Error in valueparameters (line 44)
save valueparameters.mat
How I save the file with mat extension?
  댓글 수: 6
Stephen23
Stephen23 2020년 10월 19일
편집: Stephen23 2020년 10월 19일
"How i save not in installation folder?"
The simplest approach is to change the current directory to whatever directory you want to save your file in.
Do NOT use the installation folder of any application as the current directory.
Perhaps you ended up there by mistake, it really does not matter, the fact is, you need to change your current directory.
Ivan Dwi Putra
Ivan Dwi Putra 2020년 10월 19일
ok thank you

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

채택된 답변

Tejas Turakhia
Tejas Turakhia 2020년 10월 19일
This is working on my system:
clear all
clc
% Parameter Massa
m1 = 8095; % massa train set 1 dalam kg
m2 = 8500; % massa train set 2 dalam kg
m3 = 8457; % massa train set 3 dalam kg
% Parameter Gaya
f1 = 205.*10^3; % Gaya train set 1 dalam N
f2 = 302.*10^3; % Gaya train set 2 dalam N
f3 = 302.*10^3; % Gaya train set 3 dalam N
% Parameter Resistansi
c_0_1 = 0.01176;
c_1_1 = 0.00077616;
c_2_1 = 4.48 ;
c_0_2 = 0.01176 ;
c_1_2 = 0.00077616;
c_2_2 = 4.48;
c_0_3 = 0.01176 ;
c_1_3 = 0.00077616;
c_2_3 = 4.48;
% Desired Speed
v_0 = 300;
% Desired Train Following Headway Time
hstar = 120;
a_1 = -1./m1.*(c_1_1 + 2.*c_2_1.*v_0);
a_2 = -1./m2.*(c_1_2 + 2.*c_2_2.*v_0);
a_3 = -1./m3.*(c_1_3 + 2.*c_2_3.*v_0);
a_1_head = 1-(a_1.*hstar);
a_2_head = 1-(a_2.*hstar);
a_3_head = 1-(a_3.*hstar);
b = 1;
p_1 = -1./m1.*(c_0_1 - c_2_1.*(v_0).^2);
p_2 = -1./m2.*(c_0_2 - c_2_2.*(v_0).^2);
p_3 = -1./m3.*(c_0_3 - c_2_3.*(v_0).^2);
cd('your directory address'); % add this line to change the directory where file needs to be saved
save valueparameters.mat
  댓글 수: 3
Stephen23
Stephen23 2020년 10월 19일
Rather than using cd in code (which slows code down and makes debugging more difficult) the cd command should be called just once (i.e. from the command line) to change the current directory.
To save files to a different directory using absolute/relative filenames is more efficient.
Ivan Dwi Putra
Ivan Dwi Putra 2020년 10월 19일
it works thank you

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

추가 답변 (0개)

카테고리

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

태그

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by