Community Profile

photo

per isakson


KTH

1,794 total contributions since 2010

Contact

per isakson's Badges

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

View details...

Contributions in
View by

Answered
How can I reduce the computation time for this MATLAB code? It always shows busy without giving any output
I put your code in a function and profiled it. See <https://se.mathworks.com/help/matlab/ref/profile.html profile, Profile execu...

2 hours ago | 1

Answered
extract routine data from extra large (~20GB) text file
*First shot.* I acknowledge that this might look cryptic, but it seems to work. >> filespec ='h:\m\cssm\HISTORY_Trial.txt';...

1 day ago | 1

Answered
Deleting cell arrays.
_"is there a way to completely delete cells from this array?"_ &nbsp; Hint: >> cac={ [2] [0] [1] [3] } cac = ...

10 days ago | 0

Answered
how to select range of dates
Hint: accumarray( t.Year-2007+1, stock, [], @mean ) where *|t|* is a <https://se.mathworks.com/help/matlab/ref/datetime....

10 days ago | 1

| accepted

Answered
Running pre-loaded answers for input queries on the command line in Matlab
*Background:* It's possible to overload the Matlab function, *|input|*, with your own function, *|input|*, which you put in a fo...

16 days ago | 1

| accepted

Answered
Counting number of certain letters
_"What am I doing wrong below?"_ # _"to go through each element of the string"_ &nbsp; your for-loop is fine # _"test if it'...

1 month ago | 0

Answered
Increase the number of fields within a 'for' loop?
Run %% species = 'A'; reservoir = 'B'; unit = 'C'; LITgeo.(species).(reservoir).(unit) = 1; %% LITgeo.(...

1 month ago | 0

Answered
Reading text in a cell array
if strcmp( imagetype1, 'flowers' ) % recommended

1 month ago | 0

Answered
Reading text file with number and strings
To skip the second column replace in_data = textscan(fid2,'%f%s'); by in_data = textscan(fid2,'%f%*s'); and see ...

1 month ago | 0

| accepted

Answered
How do can I change an input variable for get a different answer each time a loop runs?
Study this >> M = cssm M = 0 0.0212 0.0212 0 7.1045 7.1045 0 0 ...

1 month ago | 0

Answered
Cell contents reference from a non-cell array object?
* See <https://se.mathworks.com/help/matlab/matlab_prog/debugging-process-and-features.html Debug a MATLAB Program> *|yourInf...

1 month ago | 0

Answered
What is wrong with my code?
* See <https://se.mathworks.com/help/matlab/matlab_prog/debugging-process-and-features.html Debug a MATLAB Program> I get an ...

1 month ago | 0

| accepted

Answered
Why are people deleting answers?
I delete answers occasionally and that's because * I misunderstood the question * my answer is wrong * there are other bett...

1 month ago | 2

Answered
How can I vectorize this function with nested FOR loop?
Yes, try this >> max( cssm, [], 1 ) ans = 0 0 0 0 0 0 0 0 0 0 0 >> ...

1 month ago | 1

Answered
Cannot seem to save data to a file within a class
Yes, there is. To make it work, replace evalin('base', sprintf('save(''%s'', ''data'')', s.fileLoc)); by save( s.f...

1 month ago | 1

| accepted

Question


How to suppress message of validatestring?
z = validatestring( 'azaa', {'aaa','bbb'} ); outputs in red to the Command Window Expected input to match one of t...

1 month ago | 1 answer | 0

1

answer

Answered
Usage of Exclamation point in MATLAB?
See the documentation <https://mathworks.com/help/matlab/matlab_external/run-external-commands-scripts-and-programs.html Run Ext...

1 month ago | 1

Answered
Assgin a name to sequentially imported files
Given *|dataStruct|*. An alternative approach results = structfun( @do_some_operations_on, dataStruct, 'uni',false ); wh...

1 month ago | 0

Answered
How to compare strings in a cell
Try this %% Sample data str = char(randi(double(['A','Z']),[20,3] )); % Too smart cac = mat2cell( str, ones(1,20),3 ...

1 month ago | 0

| accepted

Answered
Writing a Leap year function without using the leapyr function
See <https://en.wikipedia.org/wiki/Gregorian_calendar> Every year that is exactly divisible by four is a leap year, except f...

1 month ago | 0

Answered
Help with optimising my code?
%% xMat = randn( 12, 1); edges = ( - 4 : 1 : 4 ); yMat = ( 1 : 12 )'; %% [ N, bin ] = histc( xMat, edge...

2 months ago | 1

| accepted

Answered
Need help in correction of error for training my data
The message says: Cell contents reference from a non-cell array object An example of this error >> a=17; >> a{1}...

2 months ago | 0

| accepted

Answered
how to select a random number from the existing matrix in each column
It's smarter to use a for-loop >> A A = 1 2 3 4 5 6 7 8 9 10 11 ...

2 months ago | 0

Answered
My Newton's Method "for loop" and table only displays the last iteration. I would like it to display all iterations. How do I do this?
Currently you overwrite the table, T, in every iteration. Replace T = table(i,t,f,dt,t0); by if i == 1 T = ...

2 months ago | 0

Answered
How do you create a new vector using every other number from your original vector. Including the first number of the original vector.
An example >> vec = randi(3,1,18) % test data vec = Columns 1 through 14 3 3 1 3 2 1 ...

3 months ago | 0

Answered
How can I delete numeric Headings/Delimiters from a large text file
And with regular expressions >> out = cssm('examplefile.txt'); >> out(1:32) ans = 1 5 0 0 2 15 0 0 3 2...

3 months ago | 0

Answered
this is my code and it has a problem while calculating kafa=y2/y12
Error using / Matrix dimensions must agree. >> whos y2 y12 Name Size Bytes Class Attrib...

3 months ago | 0

| accepted

Answered
Replace numbers by strings
One way: A = randi([80,100], 1,100 ); % Sample data C = cell(size(A)); C(A<90)={'case1'}; C(A>=90)={'case2'}; r...

3 months ago | 2

| accepted

Answered
How to replace a missing value of a table with a cell?
*|test.csv|* contains two rows Features,,,,,,,,,,,,,,,,,,,, F1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,,18,19,20 That ...

3 months ago | 1

| accepted

Answered
How to create a matrix that contains members with specific different between each element ?
Starter: >> cumsum([1,A]) ans = 1 5 12 27

3 months ago | 0

| accepted

Load more