Hi everyone.
What does this mean?
input = import3struct(location)
I couldn't understand the rule of "locaion" here.

댓글 수: 13

Rik
Rik 2020년 8월 31일
It is a variable.
Have you done a basic Matlab tutorial?
Azam Besharat
Azam Besharat 2020년 9월 1일
thanks. yes. but I still couldn't understand!
Adam Danz
Adam Danz 2020년 9월 1일
import3struct is either a variable or a function.
If it's a variable, "location" is likely indices used to select parts of the variable.
If it's a function, you could look into that function to determine what the first input is supposed to do.
It's the same as asking what "a" means here: b=f(a). No one could answer that without knowing what f and a are. Before you tell us what f and a are, what's your guess based on this advice?
Azam Besharat
Azam Besharat 2020년 9월 1일
I have a code that is a fourier transform. For this code we have to introduce an input file that have several columns to calculate the foureie transform. And we have to select one column in each part of code. I know "location" is related to this file. Maybe it indicates the number of each column.
Asad (Mehrzad) Khoddam
Asad (Mehrzad) Khoddam 2020년 9월 1일
Is the input a binary file?
Azam Besharat
Azam Besharat 2020년 9월 1일
Yes
Asad (Mehrzad) Khoddam
Asad (Mehrzad) Khoddam 2020년 9월 1일
So the function import3struct reads some structure from the binary file from location (offset) given by "location".
Azam Besharat
Azam Besharat 2020년 9월 1일
So, I have to put the location of the input file instead of the word "location"?
Asad (Mehrzad) Khoddam
Asad (Mehrzad) Khoddam 2020년 9월 1일
location is a variable. it should be set as zero at the begining. The program will change it to read more data from the file
Azam Besharat
Azam Besharat 2020년 9월 1일
편집: Rik 2020년 11월 9일
So I just set input file and the program will work.
This is a part of code:
function dipole_solid_fourier(location,orbital_no)
input = import3struct(location);
fig_ending = '.pdf';
adach_str = sprintf('%1.5f',input.adach);
%FILE_NAME = [location,'/dipolesup.dat'];
FILE_NAME = [location,'/currentsup.dat'];
Asad (Mehrzad) Khoddam
Asad (Mehrzad) Khoddam 2020년 9월 1일
Can I see the code for this function ? import3struct
Rik
Rik 2020년 11월 9일
편집: Rik 2020년 11월 9일
Why did you remove much of your question? I could only recover this from Google cache:
about location and input
Hi everyone.
What does this mean?
input = import3struct(location)
I couldn't understand the rule of "locaion" here.
And your last comment:
So I just set input file and the program will work.
This is a part of code:
function dipole_solid_fourier(location,orbital_no)
input = import3struct(location);
fig_ending = '.pdf';
adach_str = sprintf('%1.5f',input.adach);
%FILE_NAME = [location,'/dipolesup.dat'];
FILE_NAME = [location,'/currentsup.dat'];
Rik
Rik 2020년 11월 9일
And here is a backup copy of your other question, in case you try anything there:
Fourier transform of a current data file
Hi everyone I have to get fourier transform of a current data file. It's about calculating the high harmonic generation. How can I do it? Thanks for your guide

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

 채택된 답변

Asad (Mehrzad) Khoddam
Asad (Mehrzad) Khoddam 2020년 9월 1일
편집: Asad (Mehrzad) Khoddam 2020년 9월 1일

0 개 추천

So, the location is path to the folder containing the data file, for example : location = 'c:/dipole_tess';
FILE_NAME will be the absolute location of the data file. In Windows system you should use '/' instead of '\'

댓글 수: 3

Walter Roberson
Walter Roberson 2020년 9월 2일
In Windows system you should use '/' instead of '\'
"instead of" implies that on non-Windows systems that you should use '\' . However, Windows is the only OS that MATLAB runs on that permits using '\' as the directory separator, so you should not use '\' on Mac or Linux.
Perhaps you mean that on Windows systems you should use '\' instead of '/' . However, '/' is what Windows uses internally, and changes it to '\' for presentation. You can use either one on Windows. People who use Windows all the time are probably more familiar with using '\' than '/' as the directory separator. I would point out that if you use '/' then you are compatible with all three OS versions. If you want to be compatible with all three and you want to use the separator that is familiar to the user, then use fullfile() instead of using either one.
Asad (Mehrzad) Khoddam
Asad (Mehrzad) Khoddam 2020년 9월 2일
Yes I meant using '\' instead of '/' in Windows. Fortunately, even in Windows systems, we can uses '/' in Matlab to address the location of a file
Adam Danz
Adam Danz 2020년 9월 2일
Also see f = filesep

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

추가 답변 (1개)

Walter Roberson
Walter Roberson 2020년 9월 1일

0 개 추천

function dipole_solid_fourier(location,orbital_no)
input = import3struct(location);
fig_ending = '.pdf';
adach_str = sprintf('%1.5f',input.adach);
%FILE_NAME = [location,'/dipolesup.dat'];
FILE_NAME = [location,'/currentsup.dat'];
Notice that in that final line, location has a character vector appended to it. location is very likely to be a character vector itself. In particular, it is a character vector representing a directory name. The file currentsup.dat will be looked for in the given directory.

카테고리

도움말 센터File Exchange에서 File Operations에 대해 자세히 알아보기

질문:

2020년 8월 31일

댓글:

Rik
2020년 11월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by