Unrecognized function or variable 'importfile'.

조회 수: 3 (최근 30일)
Emre Solmaz
Emre Solmaz 2024년 1월 7일
댓글: Dyuman Joshi 2024년 1월 7일
I want to do the steps I have listed below, but I am encountering an importfile problem. No matter what I did, I could not import the file named .pos. Please help urgently..
clc; clear; close all;
load ref.mat
%%
wgs84= wgs84Ellipsoid('meter');
[lat, lon, h] = ecef2geodetic(wgs84, ref(1,1), ref(1,2),ref(1,3));
[x,y, utmzone, utmhemi] = wgs2utm(lat, lon);
ref=[x y h];
clear h lat lon utmhemi utmzone x y
%%
l = 2712;
a = importfile('MATLAB Drive/2_ISTA00TUR_R_20231040000_01D_30S_MO.pos', 1, 1);
[lat, lon, h] = ecef2geodetic(wgs84, a(:,4), a(:,5), a (:,6));
[x, y, utmzone, utmhemi] = wgs2utm (lat, lon);
ppp = [a(:,1) a(:,2) a(:,3) x y h];
clear a h lat lon utmhemi utmzone wgs94 x y
%%
a = ppp;
b = ref;
e = sqrt((a(:,4) - b(1,1)).^2 + (a(:,5)- b (1,2)).^2 + (a(:, 6) - b(1,3)).^2);
e = e * 100;
figure(1)
plot(e)
%%
%saga
y = 1;
m = max(abs(a(y:end, 4)- b (1, 1)))*100;
o = mean(a(y:end, 4)- b (1, 1)) * 100;
s = std(a(y:end, 4) - b (1, 1))* 100;
p = sum((a (y:end, 4)- b(1,1)).^2);
k = sqrt(p/(1-y))*100;
%%
%%saga
m1 = max(abs(a(y:end, 5)- b (1, 2)))*100;
o1 = mean(a(y:end, 5)- b (1, 2)) * 100;
s1 = std(a(y:end, 5) - b (1, 2))* 100;
p1 = sum((a (y:end, 5)- b(1,2)).^2);
k1 = sqrt(p1/(1-y))*100;
%
%h
m2 = max(abs(a(y:end, 6)- b (1, 3))) * 100;
o2 = mean(a(y:end, 6)- b (1, 3)) * 100;
s2 = std(a(y:end, 6) - b (1, 3)) * 100;
p2 = sum((a(y:end, 6)- b(1, 3)).^ 2);
k2 = sqrt(p2/(1-y))*100;
table = [m o s k m1 o1 s1 k1 m2 o2 s2 k2];
  댓글 수: 4
Dyuman Joshi
Dyuman Joshi 2024년 1월 7일
Could you attach the file? I don't have much experience with .pos files, but I can surely try something and see what works.
Use the paperclip button to attach.
Emre Solmaz
Emre Solmaz 2024년 1월 7일
The system did not allow me to upload .pos, but I am making .txt and sending it to you. If you wish, you can change the extension to .pos and use it. thanks.

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

채택된 답변

Dyuman Joshi
Dyuman Joshi 2024년 1월 7일
이동: Dyuman Joshi 2024년 1월 7일
readtable works on the text file -
T = readtable('2_ISTA00TUR_R_...1D_30S_MO.txt', 'Delimiter', ' ', ...
'ConsecutiveDelimitersRule', 'join')
T = 2595×14 table
Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9 Var10 Var11 Var12 Var13 Var14 ___________________________ __________ __________ __________ ____ ____ ______ ______ ______ ______ ______ ______ _____ _____ {'2023/04/14 00:00:00.000'} 4.2088e+06 2.3349e+06 4.1713e+06 6 18 5.9786 4.0024 6.0642 3.3246 2.2152 4.4646 0 0 {'2023/04/14 00:00:30.000'} 4.2088e+06 2.3349e+06 4.1713e+06 6 21 4.2095 2.7257 4.3165 2.4176 1.5806 3.214 0 0 {'2023/04/14 00:01:00.000'} 4.2088e+06 2.3349e+06 4.1713e+06 6 21 3.4352 2.203 3.5363 1.9883 1.2947 2.6413 0 0 {'2023/04/14 00:01:30.000'} 4.2088e+06 2.3349e+06 4.1713e+06 6 21 2.9751 1.8991 3.0702 1.7279 1.1225 2.2961 0 0 {'2023/04/14 00:02:00.000'} 4.2088e+06 2.3349e+06 4.1713e+06 6 21 2.6617 1.6944 2.7518 1.5486 1.0042 2.0591 0 0 {'2023/04/14 00:02:30.000'} 4.2088e+06 2.3349e+06 4.1713e+06 6 21 2.4305 1.5445 2.5166 1.4157 0.9164 1.8837 0 0 {'2023/04/14 00:03:00.000'} 4.2088e+06 2.3349e+06 4.1713e+06 6 21 2.2509 1.4286 2.3339 1.312 0.848 1.747 0 0 {'2023/04/14 00:03:30.000'} 4.2088e+06 2.3349e+06 4.1713e+06 6 21 2.1063 1.3356 2.1866 1.2282 0.7926 1.6366 0 0 {'2023/04/14 00:04:00.000'} 4.2088e+06 2.3349e+06 4.1713e+06 6 21 1.9865 1.2588 2.0647 1.1586 0.7465 1.5451 0 0 {'2023/04/14 00:04:30.000'} 4.2088e+06 2.3349e+06 4.1713e+06 6 21 1.8852 1.194 1.9615 1.0998 0.7075 1.4675 0 0 {'2023/04/14 00:05:00.000'} 4.2088e+06 2.3349e+06 4.1713e+06 6 21 1.7981 1.1384 1.8727 1.049 0.6738 1.4007 0 0 {'2023/04/14 00:05:30.000'} 4.2088e+06 2.3349e+06 4.1713e+06 6 21 1.7221 1.09 1.7952 1.0047 0.6444 1.3424 0 0 {'2023/04/14 00:06:00.000'} 4.2088e+06 2.3349e+06 4.1713e+06 6 21 1.6551 1.0473 1.7269 0.9656 0.6183 1.2909 0 0 {'2023/04/14 00:06:30.000'} 4.2088e+06 2.3349e+06 4.1713e+06 6 21 1.5953 1.0094 1.666 0.9308 0.5951 1.245 0 0 {'2023/04/14 00:07:00.000'} 4.2088e+06 2.3349e+06 4.1713e+06 6 21 1.5417 0.9754 1.6112 0.8995 0.5742 1.2037 0 0 {'2023/04/14 00:07:30.000'} 4.2088e+06 2.3349e+06 4.1713e+06 6 21 1.4932 0.9446 1.5617 0.8711 0.5552 1.1663 0 0
If you need the data in the 1st column as datetime array, convert accordingly -
T = convertvars(T, 1, @(x) datetime(x, 'InputFormat', 'yyyy/MM/dd hh:mm:ss.SSS'))
T = 2595×14 table
Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9 Var10 Var11 Var12 Var13 Var14 ____________________ __________ __________ __________ ____ ____ ______ ______ ______ ______ ______ ______ _____ _____ 14-Apr-2023 00:00:00 4.2088e+06 2.3349e+06 4.1713e+06 6 18 5.9786 4.0024 6.0642 3.3246 2.2152 4.4646 0 0 14-Apr-2023 00:00:30 4.2088e+06 2.3349e+06 4.1713e+06 6 21 4.2095 2.7257 4.3165 2.4176 1.5806 3.214 0 0 14-Apr-2023 00:01:00 4.2088e+06 2.3349e+06 4.1713e+06 6 21 3.4352 2.203 3.5363 1.9883 1.2947 2.6413 0 0 14-Apr-2023 00:01:30 4.2088e+06 2.3349e+06 4.1713e+06 6 21 2.9751 1.8991 3.0702 1.7279 1.1225 2.2961 0 0 14-Apr-2023 00:02:00 4.2088e+06 2.3349e+06 4.1713e+06 6 21 2.6617 1.6944 2.7518 1.5486 1.0042 2.0591 0 0 14-Apr-2023 00:02:30 4.2088e+06 2.3349e+06 4.1713e+06 6 21 2.4305 1.5445 2.5166 1.4157 0.9164 1.8837 0 0 14-Apr-2023 00:03:00 4.2088e+06 2.3349e+06 4.1713e+06 6 21 2.2509 1.4286 2.3339 1.312 0.848 1.747 0 0 14-Apr-2023 00:03:30 4.2088e+06 2.3349e+06 4.1713e+06 6 21 2.1063 1.3356 2.1866 1.2282 0.7926 1.6366 0 0 14-Apr-2023 00:04:00 4.2088e+06 2.3349e+06 4.1713e+06 6 21 1.9865 1.2588 2.0647 1.1586 0.7465 1.5451 0 0 14-Apr-2023 00:04:30 4.2088e+06 2.3349e+06 4.1713e+06 6 21 1.8852 1.194 1.9615 1.0998 0.7075 1.4675 0 0 14-Apr-2023 00:05:00 4.2088e+06 2.3349e+06 4.1713e+06 6 21 1.7981 1.1384 1.8727 1.049 0.6738 1.4007 0 0 14-Apr-2023 00:05:30 4.2088e+06 2.3349e+06 4.1713e+06 6 21 1.7221 1.09 1.7952 1.0047 0.6444 1.3424 0 0 14-Apr-2023 00:06:00 4.2088e+06 2.3349e+06 4.1713e+06 6 21 1.6551 1.0473 1.7269 0.9656 0.6183 1.2909 0 0 14-Apr-2023 00:06:30 4.2088e+06 2.3349e+06 4.1713e+06 6 21 1.5953 1.0094 1.666 0.9308 0.5951 1.245 0 0 14-Apr-2023 00:07:00 4.2088e+06 2.3349e+06 4.1713e+06 6 21 1.5417 0.9754 1.6112 0.8995 0.5742 1.2037 0 0 14-Apr-2023 00:07:30 4.2088e+06 2.3349e+06 4.1713e+06 6 21 1.4932 0.9446 1.5617 0.8711 0.5552 1.1663 0 0
Note that you will need to use the variable names or curly brackets to access the data inside.
See this documentation page for more info - Access Data in Tables
%Using variable name
T.Var1
ans = 2595×1 datetime array
14-Apr-2023 00:00:00 14-Apr-2023 00:00:30 14-Apr-2023 00:01:00 14-Apr-2023 00:01:30 14-Apr-2023 00:02:00 14-Apr-2023 00:02:30 14-Apr-2023 00:03:00 14-Apr-2023 00:03:30 14-Apr-2023 00:04:00 14-Apr-2023 00:04:30 14-Apr-2023 00:05:00 14-Apr-2023 00:05:30 14-Apr-2023 00:06:00 14-Apr-2023 00:06:30 14-Apr-2023 00:07:00 14-Apr-2023 00:07:30 14-Apr-2023 00:08:00 14-Apr-2023 00:08:30 14-Apr-2023 00:09:00 14-Apr-2023 00:09:30 14-Apr-2023 00:10:00 14-Apr-2023 00:10:30 14-Apr-2023 00:11:00 14-Apr-2023 00:11:30 14-Apr-2023 00:12:00 14-Apr-2023 00:12:30 14-Apr-2023 00:13:00 14-Apr-2023 00:13:30 14-Apr-2023 00:14:00 14-Apr-2023 00:14:30
%Using curly bracket and index
T{:, 1}
ans = 2595×1 datetime array
14-Apr-2023 00:00:00 14-Apr-2023 00:00:30 14-Apr-2023 00:01:00 14-Apr-2023 00:01:30 14-Apr-2023 00:02:00 14-Apr-2023 00:02:30 14-Apr-2023 00:03:00 14-Apr-2023 00:03:30 14-Apr-2023 00:04:00 14-Apr-2023 00:04:30 14-Apr-2023 00:05:00 14-Apr-2023 00:05:30 14-Apr-2023 00:06:00 14-Apr-2023 00:06:30 14-Apr-2023 00:07:00 14-Apr-2023 00:07:30 14-Apr-2023 00:08:00 14-Apr-2023 00:08:30 14-Apr-2023 00:09:00 14-Apr-2023 00:09:30 14-Apr-2023 00:10:00 14-Apr-2023 00:10:30 14-Apr-2023 00:11:00 14-Apr-2023 00:11:30 14-Apr-2023 00:12:00 14-Apr-2023 00:12:30 14-Apr-2023 00:13:00 14-Apr-2023 00:13:30 14-Apr-2023 00:14:00 14-Apr-2023 00:14:30
  댓글 수: 2
Emre Solmaz
Emre Solmaz 2024년 1월 7일
When I cleared my mind a little, I realized that this was exactly the problem :) This is exactly the answer. Thanks for your time. Good day sir!
Dyuman Joshi
Dyuman Joshi 2024년 1월 7일
You're welcome!
Thank you, and Good day to you as well!

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

추가 답변 (0개)

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by