matlab-load

Load multiple .mat files for processing

假装没事ソ 提交于 2020-01-14 12:03:24
问题 In MatLab I have (after extensive code running) multiple .mat files outputted to .mat files. The actual matlab name of each .mat file is called results but I've used the save command to write them to different files. A small subset of the files looks like this: results_test1_1.mat results_test1_2.mat results_test1_3.mat results_test1_4.mat results_test2_1.mat results_test2_2.mat results_test2_3.mat results_test2_4.mat Now I want to compare the results for each test, which means I have to load

Load multiple .mat files for processing

时光怂恿深爱的人放手 提交于 2020-01-14 12:02:42
问题 In MatLab I have (after extensive code running) multiple .mat files outputted to .mat files. The actual matlab name of each .mat file is called results but I've used the save command to write them to different files. A small subset of the files looks like this: results_test1_1.mat results_test1_2.mat results_test1_3.mat results_test1_4.mat results_test2_1.mat results_test2_2.mat results_test2_3.mat results_test2_4.mat Now I want to compare the results for each test, which means I have to load

Load multiple .mat files for processing

北城以北 提交于 2020-01-14 12:01:50
问题 In MatLab I have (after extensive code running) multiple .mat files outputted to .mat files. The actual matlab name of each .mat file is called results but I've used the save command to write them to different files. A small subset of the files looks like this: results_test1_1.mat results_test1_2.mat results_test1_3.mat results_test1_4.mat results_test2_1.mat results_test2_2.mat results_test2_3.mat results_test2_4.mat Now I want to compare the results for each test, which means I have to load

Why does writing to an unrelated file cause the load function to be so slow?

為{幸葍}努か 提交于 2019-12-22 08:27:51
问题 I've just spent a while debugging some particularly slow code and have been completely thrown off by the MATLAB profiler. This looks to me like a massive bug, so I was wondering if anyone could cast any light on to what is going on here. Here is some code that will cause the problem: function profiler_test %%% Create 20 files with random data count = 20; for i = 1 : count x = rand(3); save(sprintf('temp_file_%06d', i), 'x'); end %%% Load them in a for loop xs = cell(1, count); tic; for i = 1

Load part of matfile error: 'VARName' does not exist

夙愿已清 提交于 2019-12-12 04:37:56
问题 i'm trying to load part of array in a matfile like is showed in http://www.mathworks.com/help/matlab/ref/matfile.html however, when i use loadedData = matObj.varName(indices) i keep getting: 'varName' does not exist someone knows what's rong? 回答1: In place of VarName you should use the name of the actual variable you want to retrieve. Suppose you have saved a variable A into myMat : A = rand(10); save('myMat','A','-v7.3') matObj = matfile('myMat'); data = matObj.A(1:2,2); 来源: https:/

Txt import in Matlab, different row formats

拥有回忆 提交于 2019-12-11 06:06:27
问题 I need to import variables from a txt file. This file has 3 main parts. A) Initial headlines, containing general information B) Headlines-Variables, in every column C) Numerical data in every column As below: Headlines - Headlines - Headlines - Headlines Headlines - Headlines - Headlines - Headlines # A | B C | D | # ----------+----------------------------+---------------| # 1 | 0.0000E+00 + 0.0000E+00 | 0.0000 | # 2/3 | 0.0000E+00 +/- 0.0000E+00 | 0.0000 | # 4/5 | 0.0000E+00 +/- 0.0000E+00 |

MATLAB - Load data file with a string file name

自作多情 提交于 2019-12-11 04:32:34
问题 I am writing a Matlab program that loads a data file created in another C++ program. planet = input('What is the name of your planet? ', 's') data_file = strcat(planet, '.dat') load(data_file); data_file; x = data_file(:,1); y = data_file(:,2); plot (x,y,'r*') The program takes the name of the planet as the user input, then concatenates ".dat" to the end of the planet name. This gives, for example, "earth.dat," which is the name of the file created by the other C++ program. I have made sure

MATLAB - load file whose filename is stored in a string

拈花ヽ惹草 提交于 2019-12-10 12:44:31
问题 I am using MATLAB to process data from files. I am writing a program that takes input from the user and then locates the particular files in the directory graphing them. Files are named: {name}U{rate} {name} is a string representing the name of the computer. {rate} is a number. Here is my code: %# get user to input name and rate NET_NAME = input('Enter the NET_NAME of the files: ', 's'); rate = input('Enter the rate of the files: '); U = strcat(NET_NAME, 'U', rate) load U; Ux = U(:,1); Uy = U

Matlab: loading a .mat file, why is it a struct? can I just have the stored vars loaded into memory?

Deadly 提交于 2019-12-06 23:13:04
问题 Relevant code: function result = loadStructFromFile(fileName, environmentName) result = load(fileName, environmentName); bigMatrix = loadStructFromFile('values.mat','bigMatrix'); But when I look in the workspace, it shows 'bigMatrix' as a 1x1 struct. When I click on the struct, however, it is the actual data (in this case a a 998x294 matrix). 回答1: As the documentation of LOAD indicates, if you call it with an output argument, the result is returned in a struct. If you do not call it with an

Why does writing to an unrelated file cause the load function to be so slow?

懵懂的女人 提交于 2019-12-05 14:39:54
I've just spent a while debugging some particularly slow code and have been completely thrown off by the MATLAB profiler. This looks to me like a massive bug, so I was wondering if anyone could cast any light on to what is going on here. Here is some code that will cause the problem: function profiler_test %%% Create 20 files with random data count = 20; for i = 1 : count x = rand(3); save(sprintf('temp_file_%06d', i), 'x'); end %%% Load them in a for loop xs = cell(1, count); tic; for i = 1 : count x = load(sprintf('temp_file_%06d', i), 'x'); xs{i} = x.x; end toc %%% Load them in a for loop,