首页 \ 问答 \ MATLAB:将3D矩阵转换为单元阵列(MATLAB: Converting 3D matrix to cell array)

MATLAB:将3D矩阵转换为单元阵列(MATLAB: Converting 3D matrix to cell array)

我的目标是将192x88x3矩阵转换为包含192x88阵列的3x1单元阵列。 我在MATLAB中使用mat2cell ,但结果是1x1x3单元阵列看起来很奇怪。

a=rand(192,88,3);
b=mat2cell(a, [192],[88],[1 1 1])
whos b
b         1x1x3            405840  cell   

我该怎么办?


My goal is to convert 192x88x3 matrix to 3x1 cell array which includes 192x88 arrays. I used mat2cell in MATLAB but the result is 1x1x3 cell array which looks weird.

a=rand(192,88,3);
b=mat2cell(a, [192],[88],[1 1 1])
whos b
b         1x1x3            405840  cell   

What should I do?


原文:https://stackoverflow.com/questions/39746547
更新时间:2022-05-21 06:05

最满意答案

您必须为图像创建唯一的URL,因此浏览器将始终重新加载字母而不是使用缓存的字母。 你可以用一个小的PHP来实现这一点,它为参数输出正确的gif。

<img src="gif_printer.php?letter=o&t=1234567">

t参数应该是创建img标记时的时间戳。 这为重新下载提供了足够的差异。

在php设置标题中限制/禁用缓存和输出类型为gif,并简单地将图像的内容倒入stdout。

时间戳参数和缓存控制标题应足以让浏览器重新下载外部字母。

如果您的测试环境没有做出正确的反应,您可以尝试使用htaccess解决方案,但为此您必须使用Web服务器(这可能已足以使之前的解决方案正常工作)。

这意味着将任何url重写为images / [az] .gif为images / [az] .gif,因此只需删除除第一个字母和扩展名之外的其他噪音。


You have to create unique urls for the images, so the browser will always reload letters instead of using the cached ones. You could achieve this for example with a small php, which is outputting the correct gif for a parameter.

<img src="gif_printer.php?letter=o&t=1234567">

The t parameter should be the timestamp when you create the img tag. This gives enough difference to redownload.

In the php set headers to limit/disable caching and output type to gif, and simply pour the contents of the image to stdout.

The timestamp parameter and the cache-control headers should be enough for the browser to redownload evert letter.

If your test environment is not reacting correct, you could try htaccess solution, but for that you have to use a web server (and this could already be enough for the previous solution to work).

That means rewrite any url to images/[a-z].gif into images/[a-z].gif, so simply remove additional noise except the first letter and the extension.

相关问答

更多
  • 不要猜测, 测试! 认真。 只要动画GIF具有合理的尺寸,我怀疑这会是一个大问题。 但是,找出最好的方法就是尝试一下。 尝试使用Chrome或Safari的Web Inspector,通过各种策略(无动画,单独文件中的动画图标,一张图片中的所有内容)来分析页面加载时间,并查看哪个效果最好。 如果没有太大差异,请选择最简单的一个。 如果性能成为问题,您可以随时更改。 Don’t guess, test! Seriously. As long as the animated gif is of reasonab ...
  • 脚步: 使您的加载div隐藏 加载开始时,使用.show()显示它并修改CSS以使其放置正确 OnLoaded - > div.hide() 请参阅: 如何在浏览器中同步ajax调用期间显示等待消息 Steps: Make your loading div hidden When loading starts, display it using .show() and modifying the CSS so that its placement is correct OnLoaded -> div.hid ...
  • Android实际上可以解码和显示动画GIF,使用android.graphics.Movie类。 这不是太多的记录,但是在SDK参考中 。 此外,它在ApiDemos中的Samples中使用BitmapDecode示例中的一些动画标志。 Android actually can decode and display animated GIFs, using android.graphics.Movie class. This is not too much documented, but is in SD ...
  • 对于那些希望像我一样使用Imagick或Gmagick来做的人。 只需将其保存为JPG和BAM即可! public function testAnimatedGifFrame() { $testAnimGif = $this->assets.'/animated.gif'; $singleFrame = $this->assets.'/test_single_frame.jpg'; $im = new \Gmagick($testAnimGif); $frameNumber ...
  • 你需要一个ImageReader。 如果大小为1,则它不是动画,上面的所有内容都是动画。 看一下这个: public Snippet() { File f = new File("test.gif"); ImageReader is = ImageIO.getImageReadersBySuffix("GIF").next(); ImageInputStream iis; try { iis = ImageIO.cr ...
  • 目前,仍然可以使用.SWF容器显示像视频一样的GIF动画。 如果您制作此类Flash容器,则可以使用它来显示动画GIF。 容器应该是参数化的,因此您不需要对图像链接进行硬编码。 读取Flash中的参数,加载GIF图像并显示它。 完成Flash后,在浏览器中打开脚本链接(如下所示) - 它应显示动画图像。 http://website.com/container.swf?url=http://website.com/animated.gif 最后,在HTML中填写Facebook的这些元标记:
  • 我写了一个专门用于最高质量的工具: https://gif.ski ffmpeg -i video.mp4 frame%04d.png gifski -o clip.gif frame*.png 它不仅生成每帧调色板,而且还将各个调色板组合在一起,每帧可实现数千种颜色。 I've written a tool specifically for maximum quality: https://gif.ski ffmpeg -i video.mp4 frame%04d.png gifski -o clip. ...
  • GifDecoder没有工作的原因有两个。 第一个是我的错误,因为传递给read方法的String应该是一个URI: File f = new File(filename); d.read(f.toURI().toString()); 第二个问题在于GifDecoder :要检查输入URI,它将转换为小写,然后使用转换后的String在InputStream创建。 这适用于不区分大小写的操作系统(如Windows),但不适用于基于NIX的系统。 因此,我必须解决这个问题,现在它正在发挥作用。 There ...
  • 您可以计算与图像相关的scenes 。 在Rmagick中意味着做这样的事情: image = Magick::ImageList.new(image_file) if image.scene == 0 #this is not an animated gif else #this is an animated gif end You can count the scenes associated with the image. In Rmagick that means doing somet ...
  • 您必须为图像创建唯一的URL,因此浏览器将始终重新加载字母而不是使用缓存的字母。 你可以用一个小的PHP来实现这一点,它为参数输出正确的gif。 t参数应该是创建img标记时的时间戳。 这为重新下载提供了足够的差异。 在php设置标题中限制/禁用缓存和输出类型为gif,并简单地将图像的内容倒入stdout。 时间戳参数和缓存控制标题应足以让浏览器重新下载外部字母。 如果您的测试环境没有做出正确的反应,您可以尝试使 ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)