Community Profile

photo

per isakson


KTH

1,985 total contributions since 2010

Contact

per isakson's Badges

  • Ace
  • 36 Month Streak
  • Thankful Level 3
  • Revival Level 2
  • Knowledgeable Level 4
  • First Answer
  • Leader
  • Speed Demon
  • Promoter
  • Commenter
  • Solver

View details...

Contributions in
View by

Answered
Optimized code for loop, If-statement for large dataset
Try this %% ixcol = [ 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19 ]; n=0; for i = 1 : length(d_A) if all( isnan( d_A( i...

18 hours ago | 0

| accepted

Answered
A problem about using %f
Try this %% K = randi( [1e9,9e9], 1,9 ); % sample data %% cac = arrayfun( @(x) num2str(x), K, 'uni',false ); %% str = stri...

23 hours ago | 0

| accepted

Answered
Listing only a certain value in from text file
Try this %% chr = fileread('cssm.txt'); %% cac = regexp( chr, '[\d\.]+(?=[\t\r ]*$)', 'match', 'lineanchors' ); num = str2d...

2 days ago | 0

Answered
Handling large data sets
Idea : Version 7.3 MAT-files are HDF5-files. Matlab has functions to read HDF5-files, Importing HDF5 Files. The tricky pa...

2 days ago | 0

Answered
Something is nuts. Why would a working script stopped working???
The line before is in error (the brackets aren't balanced) FileToSave=[FileToGet(1:end-4) ['.jpg'] The Code Analyzer box p...

2 days ago | 0

| accepted

Answered
How to change time interval in timeseries plot?
See resample - Resample timeseries time vector

3 days ago | 0

Answered
fprintf - a troubling question
See Export Binary Data with Low-Level I/O . You should use fwrite(), not fprintf()

3 days ago | 0

Answered
How do I "use structures for function arguments"?
Try this S.x1 = 17 ; S.x2 = 18 ; S.text1 = 'ABC'; S.cmap1 = magic(3); S.cmap2 = magic(3); S.cmap3 = magic(...

3 days ago | 0

| accepted

Answered
Access to data without reading all of it
"I am slightly confused about the comments about search algorithm. [...] Is find function in Matlab not very efficient?" I'm co...

4 days ago | 0

| accepted

Answered
Error: Dot indexing is not supported for variables of this type.
I cannot reproduce your problem. This works %% parameter.A = []; a = ones(1,5); parameter.A = [parameter.A; a]; b = 2*ones...

4 days ago | 0

| accepted

Answered
MATLAB takes too long time to find solution
See Profile to Improve Performance I let your code run for a minute with the profiler active. There are a lot of warnings l...

6 days ago | 0

Answered
importing large 4GB+ tab-delimited ascii file makes MATLAB crash
That's strange. I use Win10 and R2018b (64bit). btw: What do you mean by "[...] up in complexity" ? Anyhow try >> num = cssm( ...

8 days ago | 0

Answered
Change marker size in legends of already plotted figures
Short answer: The behavior described in the stackoverflow thread is based on an undocumented feature. I've reproduce your obse...

15 days ago | 0

Answered
eliminate several columns and rows of a matrix using vectors.
Try >> m = magic( 5 ) m = 17 24 1 8 15 23 5 7 14 16 4 6 13 20 22 ...

16 days ago | 0

| accepted

Answered
Uneven spacing between texts in command window?? help!!!
Try to use a fixed-width font

18 days ago | 0

| accepted

Answered
I would to save the values for post processing from file output, can you help me?
Try this >> num = cssm('h:\m\cssm\postprocessing.txt') num = 3.15 where the file, cssm.m, contains the following c...

19 days ago | 1

| accepted

Answered
average and standard deviation of one column of a matrix
See std - Standard deviation mean - Average or mean value of array

21 days ago | 0

| accepted

Answered
How do I use if with the value of the array is a string?
Replace if f == 'NaN' by if isnan( f )

22 days ago | 0

| accepted

Answered
Help with REGEXP: extracting info from a fragment of URL inside the HTML code.
"Keep in mind that regular expressions are not a robust or neat way to parse HTML:" Anyhow, it can be used as an exercise on re...

22 days ago | 1

| accepted

Answered
Underscore doesn't work for step legend
With R2018b. Deep inside and after too many if-statements to keep track of a backslash is added. C:\Program Files\MATLAB\R201...

22 days ago | 3

Answered
creating a dynamic variable name based on cell array
"I know this is not recommended" This is one way. I think it looks a bit cleaner and is easier to use than eval() assign( myCh...

23 days ago | 0

| accepted

Answered
print cell elements with fprintf
The values of cell one, time{1}, and the rest, time{2:end}, are of different types >> time{1:2} ans = uint32 20579000 ...

24 days ago | 1

| accepted

Answered
Summing without nested loops
The loops are still there, but this is significantly faster. Comments: The calculation of besselj() dominated the use of time...

28 days ago | 1

| accepted

Answered
How do I read a block of data from excel sheet and store it in an array?
This solution uses a containers.Map rather than a cell array because I think there might be gaps in the flight_list. See contai...

1 month ago | 0

| accepted

Answered
How to convert a cell array of structs into a table?
So far so good. What to do with the field, "photos"? >> S=data.messages; >> sas = [S{[1:10]}]; >> struct2table(sas) ans = ...

1 month ago | 0

Answered
Correct way to specify default property values when constructor uses inputParser.
The default values of properties in the properties block are assigned once when the first object is created . Subsequent objects...

1 month ago | 1

| accepted

Answered
express function as function handles
See Create Function Handle and try fh = @dint2; What's density() ?

1 month ago | 0

Answered
Concatenate a column of cells into a single array
cat() is also a possiblity Y = cat( 2, X{:} ); Example >> X = { rand(4,1), rand(4,1), rand(4,1) } X = 1×3 cell array ...

1 month ago | 0

Answered
Code to run script multiple times
Assumtions: NFRO3Rec is a function that "accepts a vector x and returns a vector F" r is not changed in your code Alternate s...

2 months ago | 2

Solved


Project Euler: Problem 8, Find largest product in a large string of numbers
Find the greatest product of five consecutive digits in an n-digit number. 73167176531330624919225119674426574742355349194934...

2 months ago

Load more