Community Profile

photo

per isakson


KTH

2,031 total contributions since 2010

Contact

per isakson's Badges

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

View details...

Contributions in
View by

Answered
Group and individual means
Try this YSA1 = Y(Sub==1&A==1); SubMean = mean (YSA1);

7 days ago | 0

| accepted

Answered
is it a bug?
I call this a bug. My comments The old function, str2num(), uses eval() to do the conversion. "Eval is evil" or at least tric...

9 days ago | 2

| accepted

Answered
Save data from while loop
Your script overwrites x,y,z for each iteration. You need to assign vectors of appropriate length to x,y,z , (preallocate) befor...

11 days ago | 1

Answered
how do i set a threshold on the values of the indices in my matrices for my entire code?
Try this M(abs(M)<=1e-9) = 1e-9; where M is a matrix. And see Indexing with Logical Values

11 days ago | 0

| accepted

Answered
Possible to regexp a file with a for loop using expressions from an array?
I'm not sure that I fully understand your question. However, try this script %%-section by section %% txt = fileread( 'cssm.tx...

12 days ago | 0

Answered
Long loading time of a 60 MB matrix
"loading a 60MB matrix took an average of 100.3 seconds" >> tic, S=load('h:\m\cssm\110.mat'); toc Elapsed time is 25.627453 se...

14 days ago | 1

| accepted

Answered
Help!!! how to search for some xx xx xx xx(hex) in a dat file very fast!!!
Your question is very vaque and leaves room for interpretation. I assume that dat-file is an ordinary text file. I cannot gues...

16 days ago | 0

Answered
Convert String Array to Numeric matrix and string array
Try this %% data_events = [ "1" "60" "" "" "" "" "" "" "" "" "...

16 days ago | 0

Answered
Could someone explain what the code means
Comments on your code fragment the end of the for-loop is not shown, thus it is not clear how the value of functione is used f...

17 days ago | 0

Answered
how to run my conversion program using loops
Try this %% main_folder = 'c:\whatever\mainfolder'; sad = dir( fullfile( main_folder, '**', '*.wav' ); sad = reshape( sad, 1...

17 days ago | 0

Answered
Year conversion on figure wrong
That's most likely because 42931.00 is an Excel date number, not a Matlab date number. See Dates And Times In Excel. and http...

17 days ago | 0

Answered
How to Delete Arrays?
See clear Remove items from workspace, freeing up system memory and clearvars Clear variables from memory

17 days ago | 0

Answered
Use of nargin and varargin
It's a bit of a challenge to make this program correct easy to maintain user friendly (I assume that you really need all...

19 days ago | 1

| accepted

Answered
save figure as filename that I already have
Q1: I've learned the hard way not to mess with legend(). Thus, I pass this one. Q2: Here is a hint. Run this script on...

22 days ago | 0

| accepted

Answered
How can i fix ' Unable to perform assignment because the left and right sides have a different number of elements.' in the loop functions ?
One thing is to make a code run without throwing errors, another is to make it produce the intended result. Replacing omega3 b...

23 days ago | 0

Answered
Extracting consecutive digits using regexp
These two returns "123" %% cac = regexp('ITEM 123', '.+?(\d+)', 'tokens' ) %% cac = regexp('ITEM 123', '[^\d]+(\d+)', 'token...

24 days ago | 0

| accepted

Answered
How do I extract a number from a string?
Try this %%-section by section %% cac = { 123, 'U 2'; 'Mod3', 789 }; % Sample data %% isx = cellfun( @(chr) isa(chr,'char'),...

24 days ago | 0

| accepted

Answered
How to create a vector with "n" random elements chosen from two values stated like "bit1" and "bit0"?
Try Fs = 100; y = randi( [0,1], 1,Fs ); y(y==0) = -1;

24 days ago | 0

Answered
problem in loading .mat file (Error using load)
On Win10, R2018b I have downloaded your two files from Box successfully dragged the 'Util_Tgt0.7_SC7_dr0.07_20181111_test2_Fi...

25 days ago | 0

Answered
MatLAB gives NaN result on simple loop
"where the f2 is always not equal to f1" My steps set dbstop if naninf started your script execution halted at line 77, z3 =...

26 days ago | 0

Answered
if statement with sub cases
Try %% text = 'Time = 16:0:16 Height'; %% num = sscanf( text, 'Time = %d:%d:%d Height' ); time = [ 60*60, 60, 1 ] * num;...

27 days ago | 1

| accepted

Answered
Mismatch between file and format character vector but the CSV file contains only numerics?
dlmread() fails to read and convert quoted digits, e.g. "123","456","789". Neither does csvread(). See Comma-separated values....

27 days ago | 1

| accepted

Answered
Using Textscan on non-uniform data
An exercise with fscanf() %% ffs = "HS_full_18md_nam_outputs.txt"; fid = fopen( ffs, 'r' ); [~] = fgetl( fid ); num = fsca...

27 days ago | 1

| accepted

Answered
How can I use a specified order of strings to index from a cell array?
Run section by section %% deg_baseFileName = "Test1_female_44k_70dBA_babble7ch_1sp_20k_00dBA_48k"; %% deg_parts = strsplit(d...

29 days ago | 1

Answered
Loading Large .txt files
You didn't say how much physical memory is in your system. Matlab provides ways to handle large text files, Large Files and Bi...

1 month ago | 0

| accepted

Answered
serveral normrnd without a loop
What about this? >> cell2mat( arrayfun( @(m,l) normrnd( m, sig, [1,l] ), mu, len, 'uni',false ) ) ans = Columns 1 through ...

1 month ago | 0

| accepted

Answered
How can I run a matlab program N times using a different value of one of my variables
Assumptions: You have a script. Lets call it myScript. The first line of myScript is clear all Near the top of myScript the...

1 month ago | 0

| accepted

Answered
How to remove \n and empty line after combine all the lines into an array
Replace fgets by fgetl fgetl, Read line from file, removing newline characters In response to comment To remove the endi...

1 month ago | 1

| accepted

Answered
Replace numbers into a vector starts at the center? Looking for general format
Run this %% vec = [ 0 0 0 0 0 ]; vec1 = [ 1 1 1 ]; new_vec = [ 0 1 1 1 0 ]; %% len = length( vec ); len...

1 month ago | 1

| accepted

Answered
index exceeds matrix dimensions
Your profile shows that you over the last few months have posed ten questions in this forum and not received a single answer. Ar...

1 month ago | 1

| accepted

Load more