Community Profile

photo

per isakson


KTH

Last seen: Today Active since 2010

Statistics

All
  • Revival Level 3
  • Ace
  • Leader
  • Speed Demon
  • Personal Best Downloads Level 2
  • Editor's Pick
  • First Review
  • 5-Star Galaxy Level 4
  • First Submission
  • 36 Month Streak
  • Thankful Level 4
  • Knowledgeable Level 5

View badges

Content Feed

Answered
Data extraction from txt file with changing number of columns
TO BE CONTINUED % Example avdb( 'All-In-19-QUICK_EVAL.txt', 'test.mat' ) load test.mat % plot( LifetimeProportion.Proporti...

3 Tage ago | 0

Answered
Compare table variables with input list and replace missing vars with NA
This should work with 2017b. %% fid = fopen( 'output.csv', 'rt' ); output_csv = textscan( fid, '%s%*f', 'Headerlines',1...

6 Tage ago | 0

Question


How to find a user based on full name and eight digit number
Background: I promised to answer a question and asked the user to include a "reference" to my name - like . We used the Communit...

15 Tage ago | 1 answer | 0

1

answer

Answered
Extract data from csv with header ond footer
I've replaced "data" in your file by "3.14" and I've skipped the the two column header lines, because they are weird. Here is...

15 Tage ago | 0

| accepted

Answered
Find pattern in vector while ignoring/skipping certain indices
I assume it's a vector of integers. Steve Amphlett showed this trick at comp.soft-sys.matlab twenty years ago. %% Create sa...

26 Tage ago | 0

Answered
How to use extractBetween command?
startStr and endStr must be in the same row (i.e. in a contiguous sequence of characters). %% chr = fileread('input.txt'); m...

etwa ein Monat ago | 0

| accepted

Answered
Changing the content of an object that is contained with an array of objects
The behavior you see is the way Matlab is designed to work. See Properties Containing Objects and Property Default Values. The k...

etwa ein Monat ago | 0

Answered
Is it possible to rename columns in a table?
You can rename the variables in a table by using either the "Properties.VariableNames" property or the "renamevars" function. (I...

2 Monate ago | 33

| accepted

Answered
Separating data into one-second intervals, and finding the maximum data in each interval
%% load data num = load('Green6000X.csv'); %% split data into chunks of one second N = ceil( num(end,1) ); chunk = cell( ...

3 Monate ago | 0

| accepted

Answered
Extract files with the same names in subfolders and save them into a new folder with a different name
%% myFolder = 'current folder path'; filePattern = fullfile(myFolder,'**','*.png'); theFiles = dir(filePattern); numFiles ...

3 Monate ago | 0

| accepted

Answered
comparison of two column vectors
An example %% v1 = rand( 6,1 ); v2 = rand( 6,1 ); %% v1 > v2 This result tells us that the first, fourth, fifth and sixth ...

3 Monate ago | 0

Answered
How to set the value of a variable in one function from another?
Modify the function so that f1 takes n as an input argument function [n,x,y] = f1( n ) n; //code that does stuff with n end ...

3 Monate ago | 0

| accepted

Answered
Error with readtable function
I assume that the entire text file and the result fits in your RAM. "huge" means different things to different people. This fun...

3 Monate ago | 0

| accepted

Answered
How to delete the words/characters from a .txt file?
Another way. See documentation on textscan(), formatSpec — Format of the data fields fid = fopen( 'loadcell_data.txt' ); cac ...

3 Monate ago | 2

Answered
How do you vertically concatenate the rows of a cell array consisting of vectors of numbers?
Example m = magic(3); m = [m,m,m]; cac = num2cell(m); % sample data arrayfun( @(ix) vertcat(cac{:,ix}), [1:9], 'uni',false ...

3 Monate ago | 0

| accepted

Answered
Help with the below error
Example A = 17; % A is a scalar A(2) % there is no element with index 2

3 Monate ago | 1

| accepted

Answered
MATLAB Answers Wish-list #5 (and bug reports)
I noticed a minor issue with hyperlink. Clicking the link (marked with yellow below) in my Content Feed takes me to the wrong ...

3 Monate ago | 0

Answered
Why do I get invalid expression error for this piece of code?
Missing comma and a semicolon % disp(['The number of days between bdate,'and, 'edate'; leapyr]); % % ...

4 Monate ago | 1

Answered
How to subtract contents of cells in cell array?
The problem is that baskets_xyz is a cell array of cell arrays. Your cellfun statements requires a cell array of double (numeric...

4 Monate ago | 0

| accepted

Answered
Class : Error while assigning variables in constructor
How did you call the constructor? I added a few line to make your code a syntactically correct class. And tested the constructo...

4 Monate ago | 0

Answered
How to add header to cell matrix
No, however that depends on what you require from the "header". Is this useful? If not see table - Table array with named variab...

4 Monate ago | 0

| accepted

Answered
MATLAB Answers Wish-list #5 (and bug reports)
A minor issue By mistake I accepted an old question of mine. I realized my mistake an unaccepted the question. However, in my "...

6 Monate ago | 1

Answered
Class method is 'call by value' function, isn't it?
See Comparison of Handle and Value Classes. Your myClass is a value class. "It tells me that first input arg must be instance...

6 Monate ago | 0

Answered
Class property automatically propagated to old class instances
See Comparison of Handle and Value Classes Your exampleClass is a value class. However, the behavior you describe is more like ...

6 Monate ago | 0

| accepted

Answered
Index in position 1 exceeds array bounds. Index must not exceed 1.
What is your intention with this assignment? %% Initial condition T(:,:) = 293; % initial temperature (K) Matlab mak...

6 Monate ago | 0

Answered
Run a large number of iterations without the use of a for loop
Preallocating the variable t will improve speed a lot. Something like t = nan( 1536256, 1 ); t(1) = rf-r0; ... t(i) = rf-...

6 Monate ago | 1

Answered
How to vectorize the function?
Read Array vs. Matrix Operations. With scalars the two produce the same result, but not with vectors and arrays. The second se...

7 Monate ago | 1

| accepted

Answered
How am I suppose to fix this error. I am trying to run the code in order to get a stress vs strain plot and find the value described in the script.
This script runs without throwing errors; the syntax is correct. I assigned values to some undefined variables, lo, m, x, y. C...

8 Monate ago | 0

| accepted

Answered
Extracting the numeric part from a cell
Try >> extractBetween( "injection-0:94582)", ":", ")" ) ans = "94582"

8 Monate ago | 1

Answered
'line' returns number instead of handle inside a loop of a class method
I have reproduced your findings on R2018b. The numerical "handles" are the old type, pre R2014b. I failed to find an explanati...

8 Monate ago | 0

Load more