Réponse apportée
Rename and save multiple .mat files.
"the name on the work space is the old name" What do you expect? It's the names of the variables contained in the mat-file. The...

plus de 6 ans il y a | 0

Réponse apportée
How to extract text from string at the same location, one line above
"Is there a better/more efficient way of achieving this?" No, I don't think so. However, speed depends on how "each line for ea...

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
Replace odd numbers with infinity
%% C = randi([100,200],3,6) is_odd = rem(C,2) == 1; D = C; D( is_odd ) = inf returns C = 117 103 107 159 122 ...

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
Using dir() without changing directory?
Use an absolute path rather than a relative path (as proposed in the comments). It's easier to get it right. Thus try sad = di...

plus de 6 ans il y a | 1

| A accepté

Réponse apportée
how can I read file from a different directory
If you know the full directory name of 'b' use that, i.e chr = fileread( fullfile( 'c:', 'full', 'directory', 'name', 'of', 'b'...

plus de 6 ans il y a | 1

| A accepté

Réponse apportée
creating a matrix in matlab using a text file
It's the brackets, [], that confuses Matlab. Try A = readmatrix( 'output.txt', 'Whitespace',' []' ); I have R2018b so I can'...

plus de 6 ans il y a | 1

| A accepté

Réponse apportée
Nested for loop not iterating
I'm just guessing. Replace a_p = agrid(i) b_p=bgrid(j); fhat(i,j)=(a_p(i))-(b_p(j)).*magrange; by fhat(i,j) = ( agrid(i) - ...

plus de 6 ans il y a | 0

Réponse apportée
Previously accessible file is now inaccessible
You need to close the file after reading, add fclose( fileID ) after filedata = textscan(fileID, '%s %s %s %s %s %s %s %s')...

plus de 6 ans il y a | 1

| A accepté

Réponse apportée
How to convert all the rows containing char values to numbers in a table without for loop?
Replacing str2num by str2double might help. str2num uses eval(), which is slow. str2double takes arrays as input. %% cac =...

plus de 6 ans il y a | 0

Réponse apportée
How to extract a vector from a matrix and save in workspace?
"can I use them in a loop using their names" NO but you can loop over the columns of the matrix for jj = 1 : size( M, 1 ) ...

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
how do I substitute all negative values in a vector with a random number between 0 and 2
One way >> Y = randi( [-4,4], 1,12 ); % sample vector >> isneg = Y < 0; >> Y( isneg ) = 2*rand( 1, sum(isneg) ) Y = Co...

plus de 6 ans il y a | 0

Réponse apportée
Alternative to using global for a very large array
"unjustified waste of memory" Matlab is smarter than that, see Avoid Unnecessary Copies of Data. If LUT is look-up-table a...

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
Why eval seems to be faster than other alternatives in this example?!
Testing is tricky >> Untitled5 Elapsed time is 0.167926 seconds. Elapsed time is 0.007457 seconds. Elapsed time is 0.010043...

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
Integer check
function isf = isflint( m ) % floating double only % % http://www.mathworks.com/company/newsletters/news_notes/pd...

plus de 6 ans il y a | 0

Réponse apportée
Is vaderSentimentScores available in R2019a
No, vaderSentimentScores was Introduced in R2019b. See bottom of the page.

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
Regexp lookbehind and lineanchors
"My intent is to match 'c' that is preceded by the beginning of a line and zero or more white character." In the character arra...

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
How to use a percentage number time with a matrix
matrix * (100-10)/100

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
Matrix Dimensions Must Agree
Is this a copy&paste error? W=imread('copyright1.png'); I=imresize(I,[300 300]); Replacing the line by W=imread('copyright1....

plus de 6 ans il y a | 0

Réponse apportée
Opening R2018b .m files in R2019b
Most likely the reason is that your search path of the R2018b installation is not carried over to the R2019b installation. See S...

plus de 6 ans il y a | 0

Réponse apportée
selecting rows from C with associated values in D, while using A and B values as references to produce E and F matrices
The script %% ixe = [1,4,7]; E = cat( 2, D(ixe), C(ixe,:) ); ixf = setdiff( [1:7], ixe ); F = cat( 2, D(ixf), C(ixf,:) ); ...

plus de 6 ans il y a | 0

Réponse apportée
Append rows to .mat file
See save(filename,variables,'-append') matfile Access and change variables directly in MAT-files, without loading into ...

plus de 6 ans il y a | 0

Réponse apportée
How to import textdata & data from Excel spreadsheet into Struct, using for loop?
What is the size of SBOB ? The for-loop % % Let this be for BOB % for i = [12:14,44:60,71:82] % filename1{i} = sprintf('...

plus de 6 ans il y a | 0

Réponse apportée
Method to GREEDILY select an optional text using regular expressions?
Try %% nfolders = { 'UD_epoch' 'UD_Epoch' 'epoch' 'Epoch' 'U...

plus de 6 ans il y a | 1

Réponse apportée
Calculating storage required to store any certain array(nxn) in the .Mat file ?
Try whos -file matlab.mat See whos, List variables in workspace, with sizes and types

plus de 6 ans il y a | 0

Réponse apportée
Assigning letters to numbers
"assign letters to numbers but in reverse (A = 26, B=25, etc)" Why not start by making a function that takes letters and return...

plus de 6 ans il y a | 1

Réponse apportée
Variable highlighting isn't working
I guess the problem is with the meaning of "Variables with shared scope". See Check Variable Scope in Editor The gui you refer ...

plus de 6 ans il y a | 1

Réponse apportée
Where should we install third-party toolboxes under Windows?
That depends Are you connected to a local network? Do you have a your own drive on a local server? Are the local workstation...

plus de 6 ans il y a | 2

Réponse apportée
Call function by path or namespace?
That's a good question. These two Matlab blogs Simple Namespaces and Brilliant Function Handles A conversation about managing ...

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
[DEPRECATED] What frustrates you about MATLAB?
Background While experimenting with a function, which I had downloaded from FEX, I encountered the error No such file or dire...

plus de 6 ans il y a | 0

Réponse apportée
Is there a way to continue operation during input()?
Something like %% a script named cssm.m while true user_input = waitinput( 'prompt: ', 5, 's' ); if isnan( user_inp...

plus de 6 ans il y a | 0

Charger plus