Answered
How to find differences of 2 matrices which contain other matrices as elements?
The main problem is the choice of the data representation. Using an indexed field would allow to call setdiff(). Data.o1 = eye(...

6 years ago | 0

Answered
How do I write a sparse matrix in MATLAB
You want to convert a sparse matrix into a full one? Then use the command: full().

6 years ago | 2

Answered
How to convert a .txt file to any image format
The contents of the file does not contain enouh information to understand the format completely. The initial "2 2 1 1" might be ...

6 years ago | 0

Answered
Error with matrix multiplication?
This should work. Use the debugger to let Matlab stop when the error occurs - type this in the command window: dbstop if error ...

6 years ago | 0

Answered
define end of line (eol) as unix (\n) not Windows (\r\n) using writecell
What about writing directly? C = [{"Some string"}; {"Another string"}]; fid = fopen('testEOL.txt', 'w'); fprintf(fid, '%s\n...

6 years ago | 1

| accepted

Answered
My plot won't show any graph
I assume, this is an effect or drawing a line with just 1 point, which produces no line. Try plot(t, S(1,1), 'linewidth', 5,...

6 years ago | 0

Answered
Multiplication of very large matrix
How strange: The comments above have not been displayed on my other computer. So this answer was written 1 hour after MA's comme...

6 years ago | 0

| accepted

Answered
How to find differences of 2 matrices which contain other matrices as elements?
function [AA, AI] = CellDiff(A, B) nA = numel(A); nB = numel(B); M = false(1, nA); % Typo fixed, thanks Paul for iA = 1:n...

6 years ago | 0

Answered
Error using Conv in matlab and don't know where's the problem.
Check, if you are using the function you expect: which conv Do you get: C:\Program Files\MATLAB\R2018b\toolbox\matlab\datafun\...

6 years ago | 0

Answered
Writing ~ using fprintf
The tilde can be printed directly without escaping: fprintf('This is a tile: ~\n') And what is the problem with adding text? ...

6 years ago | 0

| accepted

Answered
Poor MEX performance when running filtfilt
Just a remark: With FiltFiltM (https://www.mathworks.com/matlabcentral/fileexchange/32261-filterm ) my Matlab 2018b needs 6.0 in...

6 years ago | 0

Answered
IF loop to select values superior of a threshold in a matrix
for k = 1:100 match = (A(k, 1:4) > 0.85); A(k, 5) = sum(A(k, match)) / sum(match); end This works faster without a...

6 years ago | 0

| accepted

Answered
Confusion about performance improvement by memory preallocation
Try to replace this part of the first solution: for z = 1:115 % 1-Hz variables from row 1 to row 115 temp = []; % ...

6 years ago | 0

| accepted

Answered
Error using readtable (line 245)
Your file is destroyed. Neither readtable, nor xlsread not Excel can open it successfully. Some of its parts are valid, as you c...

6 years ago | 0

| accepted

Answered
Using for loop within a for loop in MATLAB
Cleanup the strange nested loops over scalars: for i=1 T= 423.85; Tr(i)=T/Tc(i); ...

6 years ago | 0

Answered
Please Help me solve this loop!
You do not need a loop: S = cumsum(q - d);

6 years ago | 0

Answered
How to remove XTick labels without removing XTicks?
https://www.mathworks.com/matlabcentral/fileexchange/81858-subplots-subplotting-made-easy https://www.mathworks.com/matlabcentr...

6 years ago | 1

Answered
How to change sign of matrix
% Test data: X = rand(5, 10); S = 1 - 2 * (rand(5, 10) > 0.5); % Random matrix of 1 and -1 % The calculation: Result = X ...

6 years ago | 0

| accepted

Answered
Plot command inside a loop will not display all data unless drawnow is used
Missing plots can happen, if a timer or GUI callback changes the current figure. Instead of the instabkle method to set the curr...

6 years ago | 0

| accepted

Answered
How do I convert a 3d cell array of different size to matrix?
M = cat(3, ETT{:}); No, this cannot create a 1x10 matrix.

6 years ago | 0

| accepted

Answered
how can I appropriately get a for loop to extract wav files to sub folders(directories)??
List = dir('\\users\audio_stems\*.wav'); %folders for seperate instruments mkdir Basson mkdir Saxphone mkdir Clarinet mkdir...

6 years ago | 0

| accepted

Answered
Is it possible to vectorize this loop?
A = rand(1, 1000); B = rand(1, 1000); tic for k = 1:1000 w = 0; for i = 1:length(A) w = w + A(i).*B; end end...

6 years ago | 1

Answered
Using fprintf to repeat the statement multiple times
Almost working. n = input('Enter a integer: '); for k = 1:n fprintf('I love this stuff\n') end Ask for n before the loo...

6 years ago | 0

| accepted

Answered
I have two 3d points, A(1,0,0) and B(0,1,0). And I connect these two points as a line AB. How to divide this line into 10 equally segments and get their coordinates?
A = [1, 0, 0]; B = [0, 1, 0]; ab = B - A; v = linspace(0, 1, 10).'; C = A + v .* ab % >= R2016b, auto-expanding % ...

6 years ago | 0

Answered
how do i substract the first value from the last one on an array taking out zero values?
Get the corresponding indices: first = find(X, 1, 'first'); last = find(X, 1, 'last'); Result = X(last) - X(first)

6 years ago | 0

| accepted

Answered
how to solve this error: Error using ' TRANSPOSE does not support N-D arrays. Use PAGETRANSPOSE/PAGECTRANSPOSE to transpose pages or PERMUTE to reorder dimensions of N-D arrays
What is the size of u10 ? u10 = double(ncread(nc_windfile, 'u10')) ; size(u10) If it has more than 2 dimensions, u10' is not ...

6 years ago | 0

| accepted

Answered
How to calculate each result of f(x) in the nested for loop?
This is correct, but not useful: j = sqrt(-1); i and j are defined as imaginary units as default already. But you see the ambi...

6 years ago | 0

| accepted

Answered
input and output functions
Name your function fibseq. So call it fibseq.m, not "Fibseq.m". The case matters in Matlab. It will have one input n and one ou...

6 years ago | 1

| accepted

Answered
How to get a function from user without knowing its symbols
See how e.g. fzero and ode45 solves this problem. Here the function has 1 oder 2 variables which must be provided in a specific ...

6 years ago | 0

Answered
hObject is not created when running GUIDE *.m file - what can be done?
The m-files created by GUIDE are not compatible with other Matlab versions You can expect such troubles.

6 years ago | 0

| accepted

Load more